fix bug in form validation