v2.0 update segment: change to function