Fixed bug with prev and next buttons