Fix bug: Safe code not added when template caching is disabled.