improved the form validation