Fix to respect 'template_dir' for non Jinja2 templates (#852)

Fixes: #858 and #852