adding error handling on form submit