Fix error trapping in pagination.