fix template names must be unique in getTemplate

in some cases the same template names are used for templates with
different sources, this fixes the  caching in getTemplate so that
templates with different sources are stored under different cache keys