Fix form validation bugs