Fix validity check for OK button