 Observable :: assign = Observable :: onValue
 
 flatMap_ = (root, f, firstOnly, limit) ->
-  new EventStream describe(root, "flatMap" + (if firstOnly then "First" else ""), f), (sink) ->
+  result = new EventStream describe(root, "flatMap" + (if firstOnly then "First" else ""), f), (sink) ->
     composite = new CompositeUnsubscribe()
     queue = []
     spawn = (event) ->
       child = makeObservable(f event.value())
+      extraDeps.push(child)
       composite.add (unsubAll, unsubMe) -> child.subscribeInternal (event) ->
         if event.isEnd()
+          _.remove(child, extraDeps)
           checkQueue()
           checkEnd(unsubMe)
           Bacon.noMore

    @context = context
    @method = method
    @args = args
    @flatDeps = null

  dependsOn = (o, b) ->
    if !@flatDeps?
      @flatDeps = {}
      @collectDeps o
    return @flatDeps[b.id]

  apply: (obs) ->
    that = @

    obs.inspect = -> obs.toString()
    obs.desc = (-> { context: that.context, method: that.method, args: that.args })
    obs

withDescription = (desc..., obs) ->
  describe(desc...).apply(obs)
