fixing bug on validation