Form hangs when it is submitted