     action: (c, t) ->
       console.log('finish Huffman')
       # TODO: maybe first this should automatically finish the construction?
-      c.reconstruct_as = NodeCollection
+      c.reconstruct_as = WeightedNodeCollection
   }
 ]
 

        return null
      else if @reconstruct_as?
        newcollection = new @reconstruct_as(this.shape)
        newcollection.copyNodesFrom(this)
        delete @reconstruct_as
        return newcollection
      else

        else
          letters[c] = 1

    collection = new WeightedNodeCollection(shapes[next_shape])
    next_shape = (next_shape + 1) % shapes.length
    collection.addLeaves( letters, pos )
    collections.push(collection)
