My conditional logic is not working