diff --git a/ccsa.py b/ccsa.py
index 20d0b3b308e87ad001aed851e22e6292ad11867c..1df46e2627f8e9b544bd5709be897a7eeb2b383a 100644
--- a/ccsa.py
+++ b/ccsa.py
@@ -461,7 +461,7 @@ while True:
                                 GRAPH.add_edge(node_name1,node_name2,weight=k)
 
     G = GRAPH.to_undirected()
-    GC = max(nx.connected_component_subgraphs(G), key=len)
+    GC = max((G.subgraph(c) for c in nx.connected_components(G)), key=len)
     if START_KMER in GC and END_KMER in GC:
         list_nodes = list(GRAPH.nodes)
         for n in list_nodes: