Fix validation logic