Fixed caching of templates