Fix the segment bug