Fix refactoring with template.