fix typo and tmpl undefined problem