Fix bug where custom template path appears in output filenames

Fixes #172