added form error handling