Having issues with conditions not working