fixes bug where data in form would disappear if an error occurred