Another bug fix in template file