Fixed error on invalid form post (closes #376)