Fixed a few bugs in form code.