Hitting 'next' button to change page is working erratically