fixed bug in getTemplatePath and added associated test