fixing pagination issues