Added a number of error checks for forms.