fixed bug with global template id