make prev/next buttons work