fixes related to template (pt 1)