fix typo nextIndex vs newIndex