Fix the bug of pagination