fix backwards jinja template logic