diff --git a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py
index db009e48d2ca71052adbda9658cdbf9bcc9eaffc..3767d612872a255446df7b9ca99387011b468ce0 100644
--- a/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py
+++ b/Reconstruction/Jet/JetRecConfig/python/JetRecConfig.py
@@ -671,37 +671,6 @@ def removeComponentFailingConditions(jetdef, configflags=None, raiseOnFailure=Tr
     ## do not raise an exceptin immediately. Instead collect all failure
     ## then report all of them, then raise
 
-    fullname = jetdef.fullname()
-    
-    # define a helper function returning a filtered list of components.
-    def filterList(inList, compType):
-        nOut=0
-        outList=[]
-        basekey= compType+':' if compType!="" else ""
-        # loop over components in the list to be filtered
-        for comp in inList:
-            fullkey = basekey+comp
-            cInstance = jetdef._prereqDic[fullkey]
-            ok, reason = isComponentPassingConditions(cInstance, jetdef._cflags, jetdef._prereqDic)
-            if not ok :
-                if raiseOnFailure:
-                    raise Exception("JetDefinition {} can NOT be scheduled. Failure  of {} {}  reason={}".format(
-                        jetdef, compType, comp, reason) )
-                
-                nOut+=1
-                jetlog.info(f"{fullname} : removing {compType}  {comp}  reason={reason}")
-                if fullkey in jetdef._prereqOrder: 
-                    jetdef._prereqOrder.remove(fullkey)
-                if compType=='ghost':
-                    removeFromList(jetdef._prereqOrder, 'input:'+comp)
-                    removeFromList(jetdef._prereqOrder, 'extinput:'+comp)
-            else:
-                outList.append(comp)
-        jetlog.info(" *** Number of {} filtered components = {}  final  list={}".format(compType, nOut, outList) )
-            
-        return outList
-    # ---------
-
     # ---------
     # first check if the input can be obtained. If not return.
     ok,reason = isComponentPassingConditions( jetdef.inputdef, jetdef._cflags, jetdef._prereqDic)
@@ -713,41 +682,60 @@ def removeComponentFailingConditions(jetdef, configflags=None, raiseOnFailure=Tr
 
     if isinstance( jetdef.inputdef, JetInputConstitSeq):
         # remove ConstitModifiers failing conditions.
-        jetdef.inputdef.modifiers = filterList( jetdef.inputdef.modifiers, 'cmod' )
+        jetdef.inputdef.modifiers = filterJetDefList(jetdef, jetdef.inputdef.modifiers, 'cmod', raiseOnFailure, jetdef._cflags)
         
             
     
     # call the helper function to perform filtering :
-    jetdef.ghostdefs = filterList( jetdef.ghostdefs, "ghost")
-    jetdef.modifiers = filterList( jetdef.modifiers, "mod")
+    jetdef.ghostdefs = filterJetDefList(jetdef, jetdef.ghostdefs, "ghost", raiseOnFailure, jetdef._cflags)
+    jetdef.modifiers = filterJetDefList(jetdef, jetdef.modifiers, "mod", raiseOnFailure, jetdef._cflags)
     # finally filter all possible intermediate dependency :
-    filterList( list(jetdef._prereqOrder), "")
+    filterJetDefList(jetdef, list(jetdef._prereqOrder), "", raiseOnFailure, jetdef._cflags)
     return True
 
 
 
 def removeGroomModifFailingConditions(groomdef, configflags, raiseOnFailure=True):
 
-    mods_filtered = []
+    groomdef.modifiers = filterJetDefList(groomdef, groomdef.modifiers, "mod", raiseOnFailure, configflags)
+    filterJetDefList(groomdef, list(groomdef._prereqOrder), "", raiseOnFailure, configflags)
+
+
+
+# define a helper function to filter components from jet definition
+def filterJetDefList(jetdef, inList, compType, raiseOnFailure, configFlags):
 
-    for mod in groomdef.modifiers:
-        fullkey = 'mod:'+mod
-        cInstance = groomdef._prereqDic[fullkey]
-        ok, reason = isComponentPassingConditions(cInstance, configflags, groomdef._prereqDic)
+    nOut=0
+    outList=[]
+    basekey= compType+':' if compType!="" else ""
 
+    fullname = jetdef.fullname()
+
+    # loop over components in the list to be filtered
+    for comp in inList:
+        fullkey = basekey+comp
+        cInstance = jetdef._prereqDic[fullkey]
+        ok, reason = isComponentPassingConditions(cInstance, configFlags, jetdef._prereqDic)
         if not ok :
             if raiseOnFailure:
-                raise Exception("JetGrooming {} can NOT be scheduled. Failure  of {} {}  reason={}".format(
-                groomdef, 'mod', mod, reason) )
+                raise Exception("JetDefinition {} can NOT be scheduled. Failure  of {} {}  reason={}".format(
+                    jetdef, compType, comp, reason) )
+
+            nOut+=1
+            jetlog.info(f"{fullname} : removing {compType}  {comp}  reason={reason}")
+            if fullkey in jetdef._prereqOrder:
+                jetdef._prereqOrder.remove(fullkey)
+            if compType=='ghost':
+                removeFromList(jetdef._prereqOrder, 'input:'+comp)
+                removeFromList(jetdef._prereqOrder, 'extinput:'+comp)
+        else:
+            outList.append(comp)
 
-            jetlog.info(f"{groomdef.fullname()} : removing modifier {mod}  reason={reason}")
+    jetlog.info(" *** Number of {} filtered components = {}  final  list={}".format(compType, nOut, outList) )
+
+    return outList
 
-            if fullkey in groomdef._prereqOrder:
-                groomdef._prereqOrder.remove(fullkey)
-        else:
-            mods_filtered.append(mod)
 
-    groomdef.modifiers = mods_filtered
 
 
 def isComponentPassingConditions(component, configflags, prereqDic):
@@ -768,9 +756,6 @@ def isComponentPassingConditions(component, configflags, prereqDic):
     
 
 
-
-
-
 def isAthenaRelease():
     return 'Ath' in os.environ.get("AtlasProject", "")
 
diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasEffMonitoringAlg.cxx b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasEffMonitoringAlg.cxx
index 0b6495656328d8b3ea071cfda2faf4b36dec2ffe..b39525cb48bd31f42a29733ea60c38156ba5053e 100644
--- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasEffMonitoringAlg.cxx
+++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasEffMonitoringAlg.cxx
@@ -37,15 +37,15 @@ StatusCode HLTMinBiasEffMonitoringAlg::fillHistograms(const EventContext& contex
 
   auto vertexHandle = SG::makeHandle(m_vertexKey, context);
   const xAOD::Vertex* priVtx = nullptr;
-  for (auto vtx : *vertexHandle) {
-    if (vtx->vertexType() == xAOD::VxType::PriVtx) {
-      priVtx = vtx;
-      break;
+  if(vertexHandle.isValid()){
+    for (auto vtx : *vertexHandle) {
+      if (vtx->vertexType() == xAOD::VxType::PriVtx) {
+	priVtx = vtx;
+	break;
+      }
     }
   }
 
-
-
   auto offlineTrkHandle = SG::makeHandle(m_offlineTrkKey, context);
   int countPassing = 0;
   int countPassingVtx = 0;  
diff --git a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx
index db457e415530a807ed0e4cc4fec833eeb7f7a359..c4a67ad52f9ea0c7e49443dbd7ec5ce18fbffe7b 100644
--- a/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx
+++ b/Trigger/TrigMonitoring/TrigMinBiasMonitoring/src/HLTMinBiasTrkMonAlg.cxx
@@ -111,13 +111,16 @@ StatusCode HLTMinBiasTrkMonAlg::monitorTrkCounts(const EventContext& context) co
   float priVtxZ = 999; // intentionally - initial zPos
   auto vertexHandle = SG::makeHandle(m_vertexKey, context);
   const xAOD::Vertex* priVtx = nullptr;
-  for (auto vtx : *vertexHandle) {
-    if (vtx->vertexType() == xAOD::VxType::PriVtx) {
-      priVtxZ = vtx->z();
-      priVtx = vtx;
-      break;
+  if(vertexHandle.isValid()){
+    for (auto vtx : *vertexHandle) {
+      if (vtx->vertexType() == xAOD::VxType::PriVtx) {
+	priVtxZ = vtx->z();
+	priVtx = vtx;
+	break;
+      }
     }
   }
+
   auto offlineVtxZ = Scalar("offlineVtxZ", priVtxZ);
 
   auto offlineTrkHandle = SG::makeHandle(m_offlineTrkKey, context);
@@ -247,4 +250,4 @@ StatusCode HLTMinBiasTrkMonAlg::monitorTrkCounts(const EventContext& context) co
 
   }
   return StatusCode::SUCCESS;
-}
\ No newline at end of file
+}