Fix pagination not working correctly for listing.