diff --git a/src/factor/factor_base.cpp b/src/factor/factor_base.cpp
index bd5751fa868b8b6a8b42eb610b7fdf79279b42c3..11df542fb2650306ff959107812f819134f64eda 100644
--- a/src/factor/factor_base.cpp
+++ b/src/factor/factor_base.cpp
@@ -138,7 +138,7 @@ void FactorBase::setStatus(FactorStatus _status)
 
 void FactorBase::link(FeatureBasePtr _ftr_ptr)
 {
-    if (this->getFeature() != _ftr_ptr)
+    if (this->getFeature() && this->getFeature() != _ftr_ptr)
         unlink();
 
     if(_ftr_ptr)
diff --git a/src/processor/track_matrix.cpp b/src/processor/track_matrix.cpp
index 9b5a4fa25ad4e09ebf693e2fffb2298d68388684..e38d33f316d801f29e2f190932984c70e4216c83 100644
--- a/src/processor/track_matrix.cpp
+++ b/src/processor/track_matrix.cpp
@@ -46,9 +46,10 @@ void TrackMatrix::newTrack(FeatureBasePtr _ftr)
 
 void TrackMatrix::add(const SizeStd& _track_id, const FeatureBasePtr& _ftr)
 {
-    assert( tracks_.count(_track_id) != 0 &&  "Provided track ID does not exist. Use newTrack() instead.");
+    assert(( tracks_.count(_track_id) != 0 || _track_id == track_id_count_) &&  "Provided track ID does not exist. Use newTrack() instead.");
     assert( _ftr->getCapture() != nullptr && "adding a feature not linked to any capture");
 
+    _ftr->setTrackId(_track_id);
     tracks_[_track_id].emplace(_ftr->getCapture()->getTimeStamp(), _ftr);
     snapshots_[_ftr->getCapture()->id()].emplace(_track_id, _ftr);        // will create new snapshot if _cap_id   is not present
 }