Fixed issue dealing with templates