fix segment query