Fixed selection of incorrect item when after the last item