         else return result
   
   # Register socket.io handlers.
-  io.sockets.on 'connection', (socket) ->
+  io?.sockets.on 'connection', (socket) ->
     c = {}
     
     build_ctx = ->

  postrenders = {}
  
  app = context.app = express.createServer()
  io = context.io = socketio.listen(app)

  # Reference to the zappa client, the value will be set later.
  client = null

        else port = (Number) a
      when 'number' then port = a
      when 'function' then root_function = a
      when 'object'
        for k, v of a
          switch k
            when 'port' then port = v
            when 'disable_io' then disable_io = v

  zapp = zappa.app(root_function,disable_io)
  app = zapp.app

  if host then app.listen port, host
