Why my conditions are not working?