Conditions not working on webpage