diff --git a/fles/mcbm2018/tasks/CbmMcbm2019TimeWinEventBuilderAlgo.cxx b/fles/mcbm2018/tasks/CbmMcbm2019TimeWinEventBuilderAlgo.cxx
index ce5a726aed1276c27364ff7deeaef2d420806b3b..7bf841134ea565b604bef0452d7c31cb2ca6b07f 100644
--- a/fles/mcbm2018/tasks/CbmMcbm2019TimeWinEventBuilderAlgo.cxx
+++ b/fles/mcbm2018/tasks/CbmMcbm2019TimeWinEventBuilderAlgo.cxx
@@ -721,6 +721,7 @@ void CbmMcbm2019TimeWinEventBuilderAlgo::SetReferenceDetector(EventBuilderDetect
                       "Please also remember to update the selection windows to store "
                       "clusters!";
       RemoveDetector(refDetIn);
+      break;
     }  // if( (*det)  == refDetIn )
   }    // for( std::vector< EventBuilderDetector >::iterator det = fvDets.begin(); det != fvDets.end(); ++det )
 
diff --git a/reco/eventbuilder/digis/CbmAlgoBuildRawEvents.cxx b/reco/eventbuilder/digis/CbmAlgoBuildRawEvents.cxx
index c08de068c7020fc93341ca69850d83db7a739601..b2b4fbd98cf080dbe3ea6dc1889ea74516b4e4dd 100644
--- a/reco/eventbuilder/digis/CbmAlgoBuildRawEvents.cxx
+++ b/reco/eventbuilder/digis/CbmAlgoBuildRawEvents.cxx
@@ -798,6 +798,7 @@ void CbmAlgoBuildRawEvents::SetReferenceDetector(RawEventBuilderDetector refDetI
                       "Please also remember to update the selection windows to store "
                       "clusters!";
       RemoveDetector(refDetIn);
+      break;
     }
   }