       @locals[k] = v
 
     for k, v of @helpers
-      @locals[k] = ->
-        v(@context, @, arguments)
+      do (k, v) ->
+        @locals[k] = ->
+          v(@context, @, arguments)
 
     @locals.defs = @defs
     @locals.postrenders = @postrenders

      @locals[k] = v

    for k, v of @app.helpers
      @locals[k] = ->
        v(@context, @, arguments)

    @locals.defs = @app.defs
    @locals.postrenders = @app.postrenders

      app: (name) => @app name
      include: (path) => @include path
      require: require
      global: global
      process: process
      module: module

    @ensure_app 'default' unless @current_app?

