Fix of validation function