fix currentIndex bug