fixed off by one error in tmpl-each