Small bugfixes in templates