diff --git a/js/fea/dmaCell.js b/js/fea/dmaCell.js
index 026868571408c1f337ee532a6eb94b2ad97538c2..5cfe4ca7c2550a13a0c70aaaf2b29fa76dc97a9e 100644
--- a/js/fea/dmaCell.js
+++ b/js/fea/dmaCell.js
@@ -32,6 +32,8 @@
         this.mesh.position.y = position.y;
         this.mesh.position.z = position.z;
 
+        this.mesh.myCell = this;//we need a reference to this instance from the mesh for
+
         this._draw();
 
     //    this.parts = this._createParts(nodes, config);
@@ -60,6 +62,10 @@
     Cell.prototype.rotate = function(rx, ry, rz){
     };
 
+    Cell.prototype._destroy = function(){
+        this.mesh.myCell = null;
+    }
+
 
 
     self.Cell =  Cell;
diff --git a/js/models/lattice.js b/js/models/lattice.js
index 8466fd0f16b45ce926e84b6b15e14107c7fea454..8b05b5abbcc83877375074dd2bf50180f053b025 100644
--- a/js/models/lattice.js
+++ b/js/models/lattice.js
@@ -22,15 +22,21 @@ Lattice = Backbone.Model.extend({
     },
 
     addCell: function(position){
-        this.get("cells").push(new Cell(position));
-        this.set("numCells", this.get("numCells")+1);
+        var cells = this.get("cells");
+        cells.push(new Cell(position));
+        this.set("numCells", cells.length);
         window.three.render();
     },
 
     removeCell: function(object){
         var cells = this.get("cells");
-        cells.splice(cells.indexOf(object), 1);
-        this.set("numCells", this.get("numCells")-1);
+        var index = cells.indexOf(object.parent.myCell);
+        if (index == -1) {
+            console.warn("problem located cell in cell array");
+            return;
+        }
+        cells.splice(index, 1);
+        this.set("numCells", cells.length);
         window.three.sceneRemove(object);
         window.three.render();
     },
diff --git a/js/models/threeModel.js b/js/models/threeModel.js
index a4ccba9c30446563934db5a39d276fe233795286..0a412d26bacbdb0d5d528c3c15e39ca447870f8b 100644
--- a/js/models/threeModel.js
+++ b/js/models/threeModel.js
@@ -54,7 +54,7 @@ function ThreeModel(){
 
     function sceneRemove(object){
         var objectToRemove = object;
-        if (object.parent.type != "Scene") {
+        if (object.parent && object.parent.type != "Scene") {
             objectToRemove = object.parent;
         }
         scene.remove(objectToRemove);