Fixed issues with prev and next buttons