small bug fix for prevIndex, javascript minified