Fixing pagination issue