properly use partials in templates, add test, fixes #1504