Fix some issues with the pagination