Fixed the bug that the index is not quite right.