fix #26 by trimming segment formula