fix some bugs in Controller and LineSegment