fixing a bug in onSlideChange where the wrong slide was returned for infinite scrolling