Fixed creating/updating templates.