correct calculation of paging