Previous Next buttons disappear on dynamic image

I have an image on a page that is connected to a dataset. I added previous and next buttons to move through the images (like a slideshow) which is connected to that dataset. When the image starts, the previous button disappears. This would makes sense except that it does not appear when I move to the next image. Also, when I get to the end of the dataset items, the next button disappears. I’d like to be able to loop through the images.