diff --git a/src/graph/GraphView.cpp b/src/graph/GraphView.cpp
index 931b11a0d3199319ccd6a4c2d1639f918c947756..5cf92cb6ea3d06793f746ad42e3f3f3a9424821b 100644
--- a/src/graph/GraphView.cpp
+++ b/src/graph/GraphView.cpp
@@ -1558,13 +1558,18 @@ bool Aidge::GraphView::replace(const std::shared_ptr<GraphView>& oldGraph, const
     }
 
     // Replace old inputs with new ones
-    if (oldOIn.size() == newOIn.size()) {
+    if (oldOIn.size() >= newOIn.size()) {
       for (const auto& g : commonGraphViews) {
         auto inputs = orderedInputs.at(g);
         for (std::size_t i = 0; i < oldOIn.size(); ++i) {
           auto it = std::find(inputs.begin(), inputs.end(), oldOIn[i]);
           if (it != inputs.end()) {
-            *it = newOIn[i];
+            if (i < newOIn.size()) {
+              *it = newOIn[i];
+            }
+            else {
+              inputs.erase(it);
+            }
           }
         }
         g->setOrderedInputs(inputs);
@@ -1572,13 +1577,18 @@ bool Aidge::GraphView::replace(const std::shared_ptr<GraphView>& oldGraph, const
     }
   
     // Replace old outputs with new ones
-    if (oldOOut.size() == newOOut.size()) {
+    if (oldOOut.size() >= newOOut.size()) {
       for (const auto& g : commonGraphViews) {
         auto outputs = orderedOutputs.at(g);
         for (std::size_t i = 0; i < oldOOut.size(); ++i) {
           auto it = std::find(outputs.begin(), outputs.end(), oldOOut[i]);
           if (it != outputs.end()) {
-            *it = newOOut[i];
+            if (i < newOOut.size()) {
+              *it = newOOut[i];
+            }
+            else {
+              outputs.erase(it);
+            }
           }
         }
         g->setOrderedOutputs(outputs);