added form error checking