Fixed issue when saving template