fixing pagination bug