template context fix