diff --git a/topology.py b/topology.py
index 29acdebef7422e8064ac1629faf7d120e2ca7a80..54d47e8331330131ab57a5786d7c6bc4db52fe77 100644
--- a/topology.py
+++ b/topology.py
@@ -63,7 +63,7 @@ class Connector:
     #     self.flows[index] = replacement
 
 
-class SumConnection:
+class Connection:
     def __init__(self, in_flows, out_flows, loss_factor):
         self.in_flows = in_flows
         self.out_flows = out_flows
@@ -133,22 +133,28 @@ class Topology:
                 )
 
         self._flows = []
-        self._sum_connections = []
+        self._connections = []
+        self._connections_map = dict()
 
         for connection in configuration["connections"]:
+            index = len(self._connections)
             if connection["type"] == "OneToOne":
                 flow_from = connection["from"]
-                flow_to = connection["to"]
-                flow = flow_from + "_" + flow_to
-                self._flows.append(flow)
+                in_flow = flow_from + "_" + str(index)
+                self._flows.append(in_flow)
                 connector_from = self._connectors[flow_from]
+                connector_from.flows.append(in_flow)
+                # connector_from.other_sides.append(index)
+                in_flows = [in_flow]
+                flow_to = connection["to"]
+                out_flow = str(index) + "_" + flow_to
+                self._flows.append(out_flow)
                 connector_to = self._connectors[flow_to]
-                connector_from.flows.append(flow)
-                # connector_from.other_sides.append(connector_to)
-                connector_to.flows.append(flow)
-                # connector_to.other_sides.append(connector_from)
+                connector_to.flows.append(out_flow)
+                # connector_to.other_sides.append(index)
+                out_flows = [out_flow]
+                self._connections_map[flow_from, flow_to] = index
             elif connection["type"] == "Sum":
-                index = len(self._sum_connections)
                 in_flows = []
                 out_flows = []
                 for member in connection["members"]:
@@ -163,13 +169,11 @@ class Topology:
                     connector = self._connectors[member]
                     connector.flows.append(flow)
                     # connector.other_sides.append(index)
-                if "loss_factor" in connection:
-                    loss_factor = connection["loss_factor"]
-                else:
-                    loss_factor = 0.0
-                self._sum_connections.append(
-                    SumConnection(in_flows, out_flows, loss_factor)
-                )
+            if "loss_factor" in connection:
+                loss_factor = connection["loss_factor"]
+            else:
+                loss_factor = 0.0
+            self._connections.append(Connection(in_flows, out_flows, loss_factor))
 
         # self._removed_flows = dict()
 
@@ -399,17 +403,17 @@ class Topology:
 
             o_block.add(connector.name + "_sum", pyo.Constraint(o_block.T, rule=rule))
 
-        for i, sum_connection in enumerate(self._sum_connections):
+        for i, connection in enumerate(self._connections):
 
             def rule(m, t):
                 return pyo.quicksum(
                     o_block.component_dict[out_flow][t]
-                    for out_flow in sum_connection.out_flows
+                    for out_flow in connection.out_flows
                 ) == pyo.quicksum(
                     o_block.component_dict[in_flow][t]
-                    for in_flow in sum_connection.in_flows
+                    for in_flow in connection.in_flows
                 ) * (
-                    1.0 - sum_connection.loss_factor
+                    1.0 - connection.loss_factor
                 )
 
             o_block.add(str(i) + "_sum", pyo.Constraint(o_block.T, rule=rule))
@@ -434,21 +438,26 @@ class Topology:
             if logic["type"] == "ConnectionEnable":
                 enable = logic["enable"]
                 for i, connection in enumerate(logic["connections"]):
-                    flow = connection["from"] + "_" + connection["to"]
-                    # if flow in self._removed_flows:
-                    #     flow = self._removed_flows[flow]
-                    flow_var = o_block.component_dict[flow]
-
-                    def rule(m, t):
-                        if enable[t] == 0:
-                            return flow_var[t] == 0
-                        else:
-                            return pyo.Constraint.Skip
-
-                    o_block.add(
-                        logic_name + "_cons_" + str(i),
-                        pyo.Constraint(o_block.T, rule=rule),
-                    )
+                    flow_from = connection["from"]
+                    flow_to = connection["to"]
+                    if (flow_from, flow_to) in self._connections_map:
+                        connection = self._connections[
+                            self._connections_map[flow_from, flow_to]
+                        ]
+                        # if flow in self._removed_flows:
+                        #     flow = self._removed_flows[flow]
+                        flow_var = o_block.component_dict[connection.in_flows[0]]
+
+                        def rule(m, t):
+                            if enable[t] == 0:
+                                return flow_var[t] == 0
+                            else:
+                                return pyo.Constraint.Skip
+
+                        o_block.add(
+                            logic_name + "_cons_" + str(i),
+                            pyo.Constraint(o_block.T, rule=rule),
+                        )
 
         operational_objectives = dict()
         for name, objective in objectives.items():