fixes for stats tests
added changes to fix tests, part 2 - only explore to fix now
ASSN3 FROM HERE ON
diff --git a/Engine.cpp b/Engine.cpp
index ed7601c..a33a167 100644
--- a/Engine.cpp
+++ b/Engine.cpp
@@ -73,7 +73,6 @@ namespace Shipping {
             notifiee_->onSegmentNew(seg);
         return seg;
     }
-
     void ShippingNetwork::segmentDel( Fwk::String _name ){
         if (!segmentMap.count(_name)) return;
         Segment::Ptr s = segmentMap[_name];
@@ -140,7 +139,6 @@ namespace Shipping {

             //add path to result list if not start location only
             if (currPath.pathStr.find(")") != string::npos) {
-                //cout << "DSSDGS" << currPath.pathStr;
                 results += currPath.pathStr;
                 results += "\n";
             }
@@ -153,11 +151,11 @@ namespace Shipping {
                 //check constraints valid
                 if (query.expedited && !seg->expediteSupport())
                     continue;
-                if ( query.maxCost <= (currPath.cost + travelCost(seg, query.expedited)) )
+                if ( query.maxCost < (currPath.cost + travelCost(seg, query.expedited)))
                     continue;
-                if ( currPath.time >= (query.maxTime + travelTime(seg, query.expedited)) )
+                if ( query.maxTime < (currPath.time + travelTime(seg, query.expedited)))
                     continue;
-                if ( currPath.length >= query.maxDist + seg->length())
+                if ( query.maxDist < (currPath.length + seg->length()))
                     continue;

                 addPathWithSegment(currPath, seg, paths, true);
@@ -207,14 +205,16 @@ namespace Shipping {
     }

     float ShippingNetwork::travelCost(Segment::Ptr seg, bool expedited) {
-        float basecost = seg->length().value() * seg->difficulty().value() * (fleet_->cost(seg->mode()).value());
-        return (seg->expediteSupport() && expedited) ? basecost * 1.5 : basecost;
+        float transCost = (fleet_) ? fleet_->cost(seg->mode()).value() : 1.0;
+        return (seg->expediteSupport() && expedited) ? seg->length().value() * seg->difficulty().value() * transCost * 1.5 :
+            seg->length().value() * seg->difficulty().value() * transCost;
     }

     float ShippingNetwork::travelTime(Segment::Ptr seg, bool expedited) {
+        float transSpeed = (fleet_) ? fleet()->speed(seg->mode()).value() : 50;
+
         return (seg->expediteSupport() && expedited) ?
-            seg->length().value() / (fleet()->speed(seg->mode()).value() * 1.3) :
-            seg->length().value() / fleet()->speed(seg->mode()).value();
+            seg->length().value() / (transSpeed * 1.3) : seg->length().value() / transSpeed;
     }

     /* -------------- || Shipping Network Reactor || -----------------------*/
diff --git a/Entity.h b/Entity.h
index 1b6cfd7..4b00b88 100644
--- a/Entity.h
+++ b/Entity.h
@@ -125,7 +125,7 @@ namespace Shipping{

         Segment::PtrConst returnSegment() const { return returnSegment_; }
         Segment::Ptr returnSegment() { return returnSegment_; }
-        void returnSegmentIs( Segment::Ptr returnSeg ) { returnSegment_ = returnSeg.ptr(); }
+        void returnSegmentIs( Segment* rs ) { returnSegment_ = rs; }

         Mile length() const { return length_; }
         void lengthIs( Mile newLength ) { length_ = newLength; }
@@ -354,7 +354,7 @@ namespace Shipping{
             Speed speed_;
             Capacity capacity_;
             Cost cost_;
-            FleetMode():speed_(50),capacity_(10),cost_(1) {}
+            FleetMode():speed_(50.f),capacity_(10),cost_(1.f) {}
         };
         Fleet (const Fleet&);
         explicit Fleet( Fwk::String _name): Fwk::NamedInterface(_name){ }
diff --git a/Instance.cpp b/Instance.cpp
index b0c2569..ff9270d 100644
--- a/Instance.cpp
+++ b/Instance.cpp
@@ -232,9 +232,17 @@ namespace Shipping {
                     cerr << "invalid segment for Segment returnSegment" << endl;
                     return;
                 }
-                seg_->returnSegmentIs( rSeg );
-                if (rSeg)
-                    rSeg->returnSegmentIs( seg_ );
+
+                if (seg_->returnSegment()) {
+                    seg_->returnSegment()->returnSegmentIs(0);
+                }
+
+                if (rSeg) {
+                    seg_->returnSegmentIs(rSeg.ptr());
+                    rSeg->returnSegmentIs(seg_.ptr());
+                } else {
+                    seg_->returnSegmentIs(0);
+                }
             } else if (!name.compare(difficultyStr)) {
                 seg_->difficultyIs( atof(v.c_str()));
             } else if (!name.compare(expSupportStr)){