Fix overflow for index.