Fixed error in templates caused by refactoring