Fix overflowed index problem.