fixed bug in validate