diff --git a/exec/irc.js b/exec/irc.js
index fb44461125c96d43b72aaffd078cdcb7759c16d3..5940fb4e7fd4c98d989fe9459c25c05f2c1fa92e 100644
--- a/exec/irc.js
+++ b/exec/irc.js
@@ -894,7 +894,7 @@ function Channels_nick_quit(nick)  {
 	var i=0;
 	var j=0;
 
-	for(i=0;i<this.length;i++)  {
+	for(i=0;i<this.channel.length;i++)  {
 		for(j=0;j<this.channel[i].nick.length;j++)  {
 			if(this.channel[i].nick[j].toUpperCase()==nick.toUpperCase())  {
 				this.channel[i].nick.splice(j,1);
@@ -907,7 +907,7 @@ function Channels_nick_part(nick,cname)  {
 	var i=0;
 	var j=0;
 
-	for(i=0;i<this.length;i++)  {
+	for(i=0;i<this.channel.length;i++)  {
 		if(cname.toUpperCase()==this.channel[i].name)  {
 			for(j=0;j<this.channel[i].nick.length;j++)  {
 				if(this.channel[i].nick[j].toUpperCase()==nick.toUpperCase())  {
@@ -922,7 +922,7 @@ function Channels_nick_add(nick,cname)  {
 	var i=0;
 	var j=0;
 
-	for(i=0;i<this.length;i++)  {
+	for(i=0;i<this.channel.length;i++)  {
 		if(cname.toUpperCase()==this.channel[i].name)  {
 			this.channel[i].nick.push(nick);
 		}
@@ -934,8 +934,8 @@ function Channels_join(cname)  {
 }
 
 function Channels_joined(cname)  {
-	this.channel[this.length]=new Channel(cname);
-	this.index=this.length;
+	this.channel[this.channel.length]=new Channel(cname);
+	this.index=this.channel.length;
 	this.length++;
 }
 
@@ -946,14 +946,14 @@ function Channels_part(cname,message)  {
 		return;
 	}
 	cname=this.current.name;
-	for(i=0;i<this.length;i++)  {
+	for(i=0;i<this.channel.length;i++)  {
 		if(cname.toUpperCase()==this.channel[i].name)  {
 			this.channel[i].part(message);
 			this.channel.splice(i,1);
 			this.length -= 1;
 		}
 	}
-	if(this.index>=(this.length-1))  {
+	if(this.index>=(this.channels.length-1))  {
 		this.index=0;
 	}
 }