Added support for template names and fixed a bug with template location processing