bugfixes to template file