pagination working partially