Fixed the prev/next slide logic