Fix bug on template js