   client: (arg) ->
     pairs = if typeof arg is 'object' then arg else {default: arg}
     for k, v of pairs
-      code = ";(#{v})();"
-      @http_server.get "/#{k}.js", (req, res) ->
-        res.contentType 'bla.js'
-        res.send code
+      do (k, v) ->
+        code = ";(#{v})();"
+        @http_server.get "/#{k}.js", (req, res) ->
+          res.contentType 'bla.js'
+          res.send code
 
   style: (arg) ->
     pairs = if typeof arg is 'object' then arg else {default: arg}
     for k, v of pairs
-      @http_server.get "/#{k}.css", (req, res) ->
-        res.contentType 'bla.css'
-        res.send v
+      do (k, v) ->
+        @http_server.get "/#{k}.css", (req, res) ->
+          res.contentType 'bla.css'
+          res.send v
 
 class RequestHandler
   constructor: (handler, @defs, @helpers, @postrenders, @views, @layouts, @vars) ->

      @locals[k] = v

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

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

  read: (file) -> fs.readFileSync file, 'utf8'
  
  run_file: (file, options) ->
    @locals.__filename = require('path').join(process.cwd(), file)
    @locals.__dirname = process.cwd()
    @locals.module.filename = @locals.__filename
    code = if file.match /\.coffee$/ then @read_and_compile file else @read file
    @run code, options
  
