Fixed jinja2 templating issues