TW: Fixed edge case where no next page exists and NPE occurs.