Fix bug in form validator