Fixed bug in form validation