bug fix of pagination