fixing pagination bugs