Index: mds-and-trees/tree-genealogy.py
===================================================================
--- mds-and-trees/tree-genealogy.py	(revision 708)
+++ mds-and-trees/tree-genealogy.py	(revision 709)
@@ -711,4 +711,19 @@
             return self.ids[id]
 
+        def try_to_load(input):
+            creature = False
+            try:
+                creature = json.loads(input)
+            except ValueError:
+                print("Json format error - the line cannot be read. Breaking the loading loop.")
+                # fixing arrays by removing the last element
+                # ! assuming that only the last line is broken !
+                self.parents.pop()
+                self.children.pop()
+                self.time.pop()
+                self.kind.pop()
+                self.life_lenght.pop()
+            return creature
+
         file = open(filename)
 
@@ -720,5 +735,5 @@
                 if line_arr[0] == CLI_PREFIX:
                     line_arr = line_arr[1].split(' ', 1)
-                if line_arr[0] == "[OFFSPRING]":
+                if line_arr[0] == "[BORN]":
                     nodes += 1
 
@@ -736,4 +751,7 @@
         loaded_so_far = 0
         lasttime = timelib.time()
+
+        get_id("virtual_parent")
+
         for line in file:
             line_arr = line.split(' ', 1)
@@ -741,21 +759,35 @@
                 if line_arr[0] == CLI_PREFIX:
                     line_arr = line_arr[1].split(' ', 1)
-                if line_arr[0] == "[OFFSPRING]":
-                    try:
-                        creature = json.loads(line_arr[1])
-                    except ValueError:
-                        print("Json format error - the line cannot be read. Breaking the loading loop.")
-                        # fixing arrays by removing the last element
-                        # ! assuming that only the last line is broken !
-                        self.parents.pop()
-                        self.children.pop()
-                        self.time.pop()
-                        self.kind.pop()
-                        self.life_lenght.pop()
+                if line_arr[0] == "[BORN]":
+                    creature = try_to_load(line_arr[1])
+                    if not creature:
                         nodes -= 1
                         break
 
+                    creature_id = get_id(creature["ID"])
+
+                    # debug
+                    if loaded_so_far%1000 == 0:
+                        #print(". " + str(creature_id) + " " + str(timelib.time() - lasttime))
+                        lasttime = timelib.time()
+
+                    if "Time" in creature:
+                        self.time[creature_id] = creature["Time"]
+
+                    for prop in creature:
+                        if prop not in default_props:
+                            if prop not in self.props:
+                                self.props[prop] = [0 for i in range(nodes)]
+                            self.props[prop][creature_id] = creature[prop]
+
+                    loaded_so_far += 1
+
+                if line_arr[0] == "[OFFSPRING]":
+                    creature = try_to_load(line_arr[1])
+                    if not creature:
+                        nodes -= 1
+                        break
+
                     if "FromIDs" in creature:
-
                         # make sure that ID's of parents are lower than that of their children
                         for i in range(0, len(creature["FromIDs"])):
@@ -763,10 +795,5 @@
                                 get_id("virtual_parent")
 
-                        creature_id = get_id(creature["ID"])
-
-                        # debug
-                        if loaded_so_far%1000 == 0:
-                            #print(". " + str(creature_id) + " " + str(timelib.time() - lasttime))
-                            lasttime = timelib.time()
+                        creature_id = get_id(creature["ID"])#, False)
 
                         # we assign to each parent its contribution to the genotype of the child
@@ -781,21 +808,14 @@
                             self.parents[creature_id][parent_id] = inherited
 
-                        if "Time" in creature:
-                            self.time[creature_id] = creature["Time"]
-
                         if "Kind" in creature:
                             self.kind[creature_id] = creature["Kind"]
-
-                        for prop in creature:
-                            if prop not in default_props:
-                                if prop not in self.props:
-                                    self.props[prop] = [0 for i in range(nodes)]
-                                self.props[prop][creature_id] = creature[prop]
-
-                        loaded_so_far += 1
                     else:
                         raise LoadingError("[OFFSPRING] misses the 'FromIDs' field!")
-                if line_arr[0] == "[DIED]":
-                    creature = json.loads(line_arr[1])
+
+                if line_arr[0] == "[DIED]" or line_arr[0] == "[BORN]":
+                    creature = try_to_load(line_arr[1])
+                    if not creature:
+                        nodes -= 1
+                        break
                     creature_id = get_id(creature["ID"], False)
                     if creature_id is not None:
@@ -811,4 +831,8 @@
 
         print("NOTE: all individuals with parent not provided or missing were connected to a single 'virtual parent' node: " + str(merged_with_virtual_parent))
+
+        for c_id in range(1, nodes):
+            if not self.parents[c_id]:
+                self.parents[c_id][get_id("virtual_parent")] = 1
 
         for k in range(len(self.parents)):
