Fix template caching