prev and next buttons now work as they should