   removeNode: (node) ->
     console.log 'removeNode', node
     # unfocus node to remove
-    @nodes.selectAll('#node-'+node.id).classed('active', false)
+    if @node_active == node.id
+      @unfocusNode()
     @removeNodeData node
     @removeNodeRelations node
     @render true

  linkedByIndex:          {}
  parameters:             null
  nodes_relations_size:   null
  # Viewport object to store drag/zoom values
  viewport:
    width: 0

    console.log 'render canvas'
    @updateImages()
    @updateRelations()
    @updateRelationsLabels()
    @updateNodes()
    @updateNodesLabels()
    @updateForce restarForce
