form validation does not work properly