fix setIndex to include last item