Fix TemplateFactory.