added Error handling for forms