diff --git a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonRefitTool.cxx b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonRefitTool.cxx
index 882643a24b91a79902912044ee331fd30adf291f..2c8afbd9f79babe573ed03bea2bc0ba2a1398509 100644
--- a/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonRefitTool.cxx
+++ b/MuonSpectrometer/MuonReconstruction/MuonTrackMakers/MuonTrackMakerTools/MuonTrackFinderTools/src/MuonRefitTool.cxx
@@ -178,6 +178,7 @@ namespace Muon {
     else newTrack=std::make_unique<Trk::Track>(*track);
   
     if( settings.updateErrors ){
+      ATH_MSG_DEBUG("track hits before error updating: "<<m_printer->printMeasurements(*newTrack));
       std::unique_ptr<Trk::Track> updateErrorTrack  = m_alignmentErrors ? updateAlignmentErrors(newTrack.get(),settings)  : updateErrors(newTrack.get(),settings);
       if( !updateErrorTrack ) {
 	ATH_MSG_WARNING("Failed to update errors");
@@ -1002,6 +1003,7 @@ namespace Muon {
       trackStateOnSurfaces->push_back( nit->first ? nit->second : nit->second->clone() );
     }
     std::unique_ptr<Trk::Track> newTrack =  std::make_unique<Trk::Track>( track->info(), trackStateOnSurfaces, track->fitQuality() ? track->fitQuality()->clone():0 );
+    ATH_MSG_DEBUG("new track measurements: "<<m_printer->printMeasurements(*newTrack));
 
     return newTrack;
   }
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx
index 2f5fb625c2216dca23caa32550f55a948a7ae1a2..239bfc46f9d4816f8d03931acce87bfaed3134cd 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.cxx
@@ -55,26 +55,26 @@ namespace Muon {
       ATH_MSG_VERBOSE(" segment surface center perp " <<  layerIntersection.segment->associatedSurface().center().perp() << " z " << layerIntersection.segment->associatedSurface().center().z() << " nr of msts " << layerIntersection.segment->containedMeasurements().size() );
       ATH_MSG_VERBOSE( m_printer->print(*(layerIntersection.segment))) ;
 
-// Fix problem with segments where measurements are not ordered wrt IP 
+      // Fix problem with segments where measurements are not ordered wrt IP 
 
-// first check whether it is a Barrel or Endcap segment
+      // first check whether it is a Barrel or Endcap segment
 
       std::vector<const Trk::MeasurementBase*> containedMeasurements = layerIntersection.segment->containedMeasurements();
       std::vector<const Trk::MeasurementBase*>::const_iterator mit     = containedMeasurements.begin();
       std::vector<const Trk::MeasurementBase*>::const_iterator mit_end = containedMeasurements.end();
       for(; mit!=mit_end; ++mit) {
-     // get Identifier
+	// get Identifier
         Identifier id;
         const Trk::RIO_OnTrack* rio = dynamic_cast<const Trk::RIO_OnTrack*>(*mit);
         if (rio)  id=rio->identify();
         else {
           const Trk::CompetingRIOsOnTrack* crio=dynamic_cast<const Trk::CompetingRIOsOnTrack*>(*mit);
           if (crio) id=crio->rioOnTrack(0).identify();
-         else continue;
+	  else continue;
         }
-     // check if valid ID
-       if( !id.is_valid() ) continue;
-     // check if muon
+	// check if valid ID
+	if( !id.is_valid() ) continue;
+	// check if muon
         if (!m_idHelperSvc->isMuon(id)) continue;
         
         if(m_idHelperSvc->isEndcap(id)) { 
@@ -85,12 +85,11 @@ namespace Muon {
         if(m_idHelperSvc->isTrigger(id)) continue; 
 
         if(m_idHelperSvc->isSmallChamber(id)) { 
-         isSmall = true;
+	  isSmall = true;
         } else {
          isLarge = true;
         }
-        break;
-      } 
+      }
        
       if(m_reOrderMeasurements) {
 	// reorder measurements using SortMeas (defined in header file)
@@ -102,7 +101,7 @@ namespace Muon {
 			   containedMeasurements.end() );
     }
 
-    // reorder in case of Small Large overlaps in Barrel or Endcap ONLY   
+    // reorder in case of Small Large overlaps in Barrel or Endcap ONLY
 
     bool reorderAllMeasurements = false;
     if(isSmall&&isLarge) reorderAllMeasurements = true;
@@ -114,7 +113,7 @@ namespace Muon {
       std::stable_sort(measurements.begin(),measurements.end(),SortMeas(&*m_edmHelperSvc,&*m_idHelperSvc,isEndcap));
     }
 
-    ATH_MSG_VERBOSE( m_printer->print(measurements)) ;
+    ATH_MSG_VERBOSE( "final measurement list: "<<m_printer->print(measurements)) ;
 
     ATH_MSG_DEBUG("Extracted hits from candidate: " << measurements.size() );
     Trk::Track* refittedTrack = m_trackFitter->indetExtension(idTrack,measurements);
diff --git a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h
index b3e73e2bdf05714c4a489aa7f113c8067407e197..77ec5b57bdb4e123a293435933a043ce02d2b0d0 100644
--- a/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h
+++ b/Reconstruction/MuonIdentification/MuonCombinedTrackFindingTools/src/MuonCandidateTrackBuilderTool.h
@@ -28,11 +28,12 @@ namespace Muon {
   public:
     bool operator()(const Trk::MeasurementBase* mst1,const Trk::MeasurementBase* mst2) const{
       if(isEndcap) {
-	return fabs(mst1->globalPosition().z()) < fabs(mst2->globalPosition().z());
+	return std::abs(mst1->globalPosition().z()) < std::abs(mst2->globalPosition().z());
       }
       else {
 	Identifier id1=m_edmHelperSvc->getIdentifier(*mst1);
 	Identifier id2=m_edmHelperSvc->getIdentifier(*mst2);
+	if(!id1.is_valid() || !id2.is_valid()) return std::abs(mst1->globalPosition().z()) < std::abs(mst2->globalPosition().z());
 	if(m_idHelperSvc->isMdt(id1) && m_idHelperSvc->isMdt(id2)) return mst1->globalPosition().perp() < mst2->globalPosition().perp();
 	else if(m_idHelperSvc->isRpc(id1) && m_idHelperSvc->isMdt(id2)){
 	  if(m_idHelperSvc->rpcIdHelper().doubletR(id1)==1){