Template off-by-one errors