bug fixing for validation code.