fixed a bug in the validation code