fixed bug with validation