found an error in segment length calculation