jinja2 -> templates, legacy fixes