bug fix in templates