Fix infinity pagination issue