templates and bugfix
solved merge conflicts