Fixed a couple of silly bugs introduced; don't assume template