bug fix in template worker