diff --git a/Generators/GeneratorFilters/src/BSignalFilter.cxx b/Generators/GeneratorFilters/src/BSignalFilter.cxx
index 9d3d8b7a7c9fd8f66bfe1daf185a4f8152e89e8b..3ad5ca696e0116679c06bb86419d6faddd01542c 100644
--- a/Generators/GeneratorFilters/src/BSignalFilter.cxx
+++ b/Generators/GeneratorFilters/src/BSignalFilter.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2021 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 // -----------------------------------------------------------------------------------------------
@@ -480,7 +480,7 @@ void BSignalFilter::FindAllChildren(const HepMC::ConstGenParticlePtr& mother,std
   if( (!fromFinalB) && (MC::PID::isBottomMeson(pID) || MC::PID::isBottomBaryon(pID)) )
     {
       fromFinalB = true;
-      int pID;
+      int pID{};
       for (auto thisChild = firstChild; thisChild != lastChild; ++thisChild)
 	{
 	  pID = (*thisChild)->pdg_id();
@@ -489,7 +489,10 @@ void BSignalFilter::FindAllChildren(const HepMC::ConstGenParticlePtr& mother,std
     }
 
   // ** Main loop: iterate over all children, call method recursively.
-  for (auto thisChild = firstChild; thisChild != lastChild++; ++thisChild)
+  //Note: Iterators changed between HEPMC2 and HEPMC3; the previous version
+  //was a custom iterator which could be incremented indefinitely, always returning
+  //'end' when necessary. In HEPMC3, these are standard library iterators
+  for (auto thisChild = firstChild; thisChild != lastChild; ++thisChild)
     {
       childCnt++;
       std::stringstream childCntSS; childCntSS << childCnt;
diff --git a/Generators/GeneratorFilters/src/TTbarMassFilter.cxx b/Generators/GeneratorFilters/src/TTbarMassFilter.cxx
index b00756203fde57bb31747830e5a640bdace3f113..1f9a1ec9f449e0c06fccd3a929867ff4002df796 100644
--- a/Generators/GeneratorFilters/src/TTbarMassFilter.cxx
+++ b/Generators/GeneratorFilters/src/TTbarMassFilter.cxx
@@ -1,5 +1,5 @@
 /*
-  Copyright (C) 2002-2020 CERN for the benefit of the ATLAS collaboration
+  Copyright (C) 2002-2023 CERN for the benefit of the ATLAS collaboration
 */
 
 #include "GeneratorFilters/TTbarMassFilter.h"
@@ -70,7 +70,7 @@ StatusCode TTbarMassFilter::filterEvent() {
           if (!prodVtx) {
             ATH_MSG_WARNING("Top particle with a status " << mcpart->status() << " has no valid production vertex");
             //save null pointer for consistency
-            top_vtxs.push_back(nullptr);
+            top_vtxs.emplace_back(nullptr);
           } else {
             // Loop until the 'first' top particle  production vertex is not reached
             while (!isFirstTop && prodVtx) {
@@ -82,7 +82,7 @@ StatusCode TTbarMassFilter::filterEvent() {
                   prodVtx = mother_mcpart->production_vertex();
                   if (!prodVtx) {
                     ATH_MSG_WARNING("mother particle is still a top with a status " << mcpart->status() << ", but has no valid production vertex");
-                    top_vtxs.push_back(nullptr);
+                    top_vtxs.emplace_back(nullptr);
                   }
                   break;
                 } else {
@@ -280,8 +280,13 @@ StatusCode TTbarMassFilter::filterEvent() {
       setFilterPassed(false);
       return StatusCode::SUCCESS;
     }
+    if ((top_21 < 0) or (top_22 < 0)) {
+      ATH_MSG_ERROR("Indexing error. Event failed the filter");
+      setFilterPassed(false);
+      return StatusCode::SUCCESS;
+    }
 
-    // Check that the second top-pair relly has the same production vertex
+    // Check that the second top-pair really has the same production vertex
     if (top_vtxs[top_21] != top_vtxs[top_22]) {
       ATH_MSG_ERROR("Production vertex for the second top-pair particles is not the same. Event failed the filter");
       setFilterPassed(false);