fixed the pagination problem