Fix the conditional logic