Corrected validation code.