Fixed bugs in form error handling