                             cb(err)
                         else
                             if result.length == 1 and result[0][0]
+                                host = result[0][0]
                                 dbg("got host='#{host}'")
-                                host = result[0][0]
+                            else
+                                dbg("no host assigned")
                             cb()
             (cb) =>
                 if host?

        ], (err) =>
            if not err
                @host = host
                if host != previous_host
                    dbg("host changed from #{previous_host} to #{host}")
            dbg("time=#{misc.mswalltime(t)}ms")
            opts.cb(err, host)
        )

                                    # tell every project whose state was set via
                                    # this socket that the state is no longer known.
                                    if p._socket_id == socket.id
                                        p.clear_state()
                                        delete p._socket_id
                                if @_socket_cache[opts.host]?.id == socket.id
                                    delete @_socket_cache[opts.host]
