Fixed the validation code.