fix a bug for template