           children_width += cb.width
           children_max_height = Math.max(children_max_height, cb.height)
 
-        width = Math.max(width, children_width)
-        height = Math.max(height,
+        width = Math.max(own_width, children_width)
+        height = Math.max(own_height,
           children_max_height + 2 * default_node_radius)
 
         x = -width/2

      console.log('finish Huffman')
      # TODO: maybe first this should automatically finish the construction?
      c.reconstruct_as = WeightedNodeCollection
  }
]

shannon_fano_dropdown_menu = [
  {
    name: 'automatic Shannon-Fano step',
    action: (c, t) ->

      pidx = moved_nodes.indexOf(p)
      ppos = new_positions[pidx]

      if c.getSize?
        {height: own_height} = c.getSize()
      else
        own_height = c.radius * 2

      newpos = (x: ppos.x + pos.x, y: ppos.y + pos.y + own_height/2)
      new_positions.push(newpos)
      moved_nodes.push(c)

