Fix an index offset bug.