Fix off-by-one indexing error.