Fix #28. Also look into the transitive closure to get template name.