Fix template.js issue