Index: trunk/src/tmcsim/cadsimulator/Coordinator.java
===================================================================
--- trunk/src/tmcsim/cadsimulator/Coordinator.java	(revision 466)
+++ trunk/src/tmcsim/cadsimulator/Coordinator.java	(revision 471)
@@ -837,5 +837,7 @@
             public int compare(String o1, String o2) 
             {
-                return extractInt(o1) - extractInt(o2);
+                // extract just the timestamp from the strings and convert them to int
+                // fixes #181
+                return extractInt(o1.substring(0,8)) - extractInt(o2.substring(0,8));
             }
             // extract an integer from a String    
@@ -843,6 +845,14 @@
             {   // remove all non-digits
                 String num = s.replaceAll("\\D", "");
-                // return 0 if no digits found, else return the number
-                return num.isEmpty() ? 0 : Integer.parseInt(num);
+                try
+                {
+                    // return 0 if no digits found, else return the number
+                    return num.isEmpty() ? 0 : Integer.parseInt(num);
+                } catch (NumberFormatException ex)
+                {
+                    System.out.println("Can't convert "+s+" to integer in writeToCAD. " + 
+                    ex.getMessage());
+                    return 0;
+                }
             }
         });
Index: trunk/src/tmcsim/application.properties
===================================================================
--- trunk/src/tmcsim/application.properties	(revision 469)
+++ trunk/src/tmcsim/application.properties	(revision 471)
@@ -1,5 +1,5 @@
-#Sat, 27 Jul 2019 22:04:01 -0700
+#Mon, 29 Jul 2019 14:47:09 -0700
 
-Application.revision=467
+Application.revision=470
 
-Application.buildnumber=176
+Application.buildnumber=177
