Fixed off-by-one bug.