fixing pagination segment bug