Fixed problem with templates