Fixed bugs in the template and saving form