modify next index logic.