fixed paging bugs, covered paging logics with unit tests