How do I get conditions to work correctly?