             return
           if state.countFulfilled() > 1
             f = state.getBranches()[0]
-            f.forEach (f, i) =>
+            f.forEach (fulfilled, i) =>
               choice.branch "#{choice.id}_#{i}", (bnode) =>
-                log.values "#{@name or @id} #{choice} resulted via branch #{bnode} in #{typeof f.value} %s", f.value
-                bnode.registerSubleaf f.choice, true, true
-                f.value
+                log.values "#{@name or @id} #{choice} resulted via branch #{bnode} in #{typeof fulfilled.value} %s", fulfilled.value
+                bnode.registerSubleaf fulfilled.choice, true, true
+                fulfilled.value
             return
           if state.countRejected()
             [rejected] = state.getBranches state.rejected

    callback t, tree if callback
    t

  onBranch: (orig, branch, callback) =>
    log.tree "#{@name or @id} Branch #{branch} from #{orig}"
    if orig.id is 'root'
      throw new Error 'Cannot branch the root node'
    originalNode = @nodes[orig.id]
    unless originalNode
      throw new Error "Source node #{orig.id} not found"
    id = @registerNode originalNode.promiseSource, branch.name, originalNode.type, callback, false
    sourcePath = if orig.source then orig.source.toString() else ''
    branch.treeId = @id
    @nodes[id].choices[sourcePath] = branch

      destinations: []
      branches: []

    unless onlySource
      @findSources @nodes[id], autoresolve
    else
      @nodes[id].sources.push @nodes[onlySource]
      @nodes[onlySource].destinations.push @nodes[id]

    id

