diff --git a/cost_function.py b/cost_function.py
index cd5b4a562f672002c1d16bfb88825f2fac9496d1..e5f273b21597936444a0e4169ff499f050b8b9ec 100755
--- a/cost_function.py
+++ b/cost_function.py
@@ -103,12 +103,11 @@ delta_r_std = 8.6953 * 1000
 # Load the graph_tool file:
 
 print('Loading graph...')
-g = graph_tool.Graph()
 
 try:
-    g.load('segments.gt')
+    g = graph_tool.load_graph('segments.gt')
 except FileNotFoundError:
-    g.load('segments.graphml')
+    g = graph_tool.load_graph('segments.graphml')
 
 print('Loading done...')
 print("Input graph:")
diff --git a/segments.py b/segments.py
index 351da8f295ace8bd278cf2f3905bc2e4396469e3..f59f4464106ca4e50fa4e22ffce298b1ee489900 100755
--- a/segments.py
+++ b/segments.py
@@ -1,9 +1,9 @@
 #!/usr/bin/env python3
 
 """Collapses the input graph of instantaneous eddies into a new graph:
-the graph of segments. A vertex of the new graph is a segment. The new
-graph is output in the binary format of Graph-tool. Input file should
-be an edgelist in CSV format. Output file can have suffix ".gt" or
+the graph of segments. A vertex of the new graph is a segment. Input
+file should be an edgelist in CSV format. The new graph is output in a
+file with suffix ".gt", for the binary format of Graph-tool, or
 ".graphml".
 
 """