changed the validation code

changed the validation code from