fixed segment bug