finalized fixing of pagination