fixed nextPageExists method