Minor template bugfixes