Fixed some bugs in forms