Fix caching templates