     bind_fn = (name, op) ->
       bound = (args...) ->
         # if the function returned a value, unwrap it. otherwise, ignore it
-        op.fn.apply(run_context.root_context.current_context, args)?._lead_context_fn_value ? ignore
+        op.fn.apply(run_context.active_context(), args)?._lead_context_fn_value ? ignore
       bound._lead_context_fn = op
       bound._lead_context_name = name
       bound

        previous_context = run_context.current_context
        run_context.current_context = context
        try
          fn.apply(context)
        finally
          run_context.current_context = previous_context

      render: (o) ->
        @nested 'renderable', handle_renderable, o

      else
        run_context[name] = mod
    run_context.current_context = run_context

    run_context

