diff --git a/exec/load/ircd_channel.js b/exec/load/ircd_channel.js
index f9c9e13e6d5a95c7a97ea716de5f820851a02e18..5a66b26ff51bd8bfe65fab7faa9d36e9b06be66c 100644
--- a/exec/load/ircd_channel.js
+++ b/exec/load/ircd_channel.js
@@ -540,15 +540,11 @@ function IRCClient_do_join(chan_name,join_key) {
 		this.numeric403(chan_name);
 		return 0;
 	}
-	for (theChar in chan_name) {
-		var theChar_code = chan_name[theChar].charCodeAt(0);
-		if ((theChar_code <= 32) || (theChar_code == 44) ||
-		    (chan_name[theChar].charCodeAt(0) == 160)) {
-			if (this.local)
-				this.numeric(479, chan_name
-					+ " :Channel name contains illegal characters.");
-			return 0;
-		}
+	if(chan_name.search(/[\x00-\x20\x2c\xa0]/)!=-1) {
+		if (this.local)
+			this.numeric(479, chan_name
+				+ " :Channel name contains illegal characters.");
+		return 0;
 	}
 	if (this.channels[uc_chan_name])
 		return 0;
diff --git a/exec/load/ircd_user.js b/exec/load/ircd_user.js
index 312bcca358b6a458e62d34c816926fccfab158b8..53e50f10735ec2b916657cef133c6a7494264c53 100644
--- a/exec/load/ircd_user.js
+++ b/exec/load/ircd_user.js
@@ -1348,10 +1348,10 @@ function User_Work() {
 		}
 		var firstnick="";
 		var aWhoWas;
+		var ww_nick_uc = cmd[1].toUpperCase();
 		for (aWhoWas=whowas_pointer;aWhoWas>=0;aWhoWas--) {
 			var wwh = WhoWasHistory[aWhoWas];
-			if (wwh && (wwh.nick.toUpperCase() ==
-			    cmd[1].toUpperCase())) {
+			if (wwh && (wwh.nick.toUpperCase() == ww_nick_uc))
 				this.numeric(314,wwh.nick + " " + wwh.uprefix + " " + wwh.host
 					+ " * :" + wwh.realname);
 				this.numeric(312,wwh.nick + " " + wwh.server + " :"
@@ -1362,8 +1362,7 @@ function User_Work() {
 		}
 		for (aWhoWas=whowas_buffer;aWhoWas>=whowas_pointer;aWhoWas--) {
 			var wwh = WhoWasHistory[aWhoWas];
-			if (wwh && (wwh.nick.toUpperCase() ==
-			    cmd[1].toUpperCase())) {
+			if (wwh && (wwh.nick.toUpperCase() == ww_nick_uc))
 				this.numeric(314,wwh.nick + " " + wwh.uprefix + " " + wwh.host
 					+ " * :" + wwh.realname);
 				this.numeric(312,wwh.nick + " " + wwh.server + " :"