bugfixes, improved some templates