             # First msg should be the client's browserID
             console.log("Socket.io client handshake: #{browserID}")
             # Look up the client's BrowserInstance
-            browsers.find encodeURIComponent(browserID), (browser) ->
+            browsers.find decodeURIComponent(browserID), (browser) ->
                 # clientConnected processes client's messages.
                 browser.addClient(client)
 

                browsers : browsers.browsers,
                files : files.filter((file) -> /\.html$/.test(file)).sort()

    server.get '/browsers/:browserid', (req, res) ->
        # TODO: permissions checking and making sure browserid exists would
        # go here.
        id = decodeURIComponent(req.params.browserid)
        console.log "Joining: #{id}"
        res.render 'base.jade', browserid : id

    server.post '/create', (req, res) ->
        browserInfo = req.body.browser

        try
            browsers.create(id, resource)
            console.log 'BrowserInstance loaded.'
            res.writeHead(301, {'Location' : "/browsers/#{id}/index.html"})
            res.end()
        catch e
            console.log "browsers.create failed"
