fixed bug in validation