diff --git a/demos/chat/chat.js b/demos/chat/chat.js
index <HASH>..<HASH> 100644
--- a/demos/chat/chat.js
+++ b/demos/chat/chat.js
@@ -118,8 +118,9 @@ irc.onerror = function(command) {
     // 433     ERR_NICKNAMEINUSE
         nickname += '_'
         irc.nick(nickname)
-        self.onUsernameTaken();
+        irc.join(CHANNEL)
     }
+}
 
 
   irc.onresponse = function(command) {
fixed parsing error in chat demo; actually join channel when nickname was taken