Conditions are not working properly