Fixed an issue with correct records being selected for the pagination.