Fixed compiling of templates