 
     # Ensure components are loaded before continuing
     network.loader.listComponents ->
-      network.addNode node for node in graph.nodes
-      network.addEdge edge for edge in graph.edges
-      network.addInitial initializer for initializer in graph.initializers
-      callback network if callback
+      toAdd = graph.nodes.length + graph.edges.length + graph.initializers.length
+
+      if toAdd is 0
+        callback network
+        return
+
+      for node in graph.nodes
+        network.addNode node, ->
+          toAdd--
+          callback network if callback? and toAdd is 0
+
+      for edge in graph.edges
+        network.addEdge edge, ->
+          toAdd--
+          callback network if callback? and toAdd is 0
+
+      for initializer in graph.initializers
+        network.addInitial initializer, ->
+          toAdd--
+          callback network if callback? and toAdd is 0
 
     network
 
 exports.loadFile = (file, success, debug = false) ->
     graph.loadFile file, (net) ->
-        success exports.createNetwork net, debug
+        exports.createNetwork net, debug, success
 
 exports.saveFile = (graph, file, success) ->
     graph.save file, ->


        @portBuffer[id]

    addEdge: (edge) ->
        return @addInitial(edge) unless edge.from.node
        socket = internalSocket.createSocket()
        @addDebug socket if @debug

        @connectPort socket, from, edge.from.port, false

        @connections.push socket
        callback() if callback

    removeEdge: (edge) ->
        for connection,index in @connections
