fixed bugs on validation