Fixed issue #8861: Template name is forgotten after template rename