diff --git a/system/codeigniter/CodeIgniter.php b/system/codeigniter/CodeIgniter.php
index 1f7850e..5c3d19b 100644
--- a/system/codeigniter/CodeIgniter.php
+++ b/system/codeigniter/CodeIgniter.php
@@ -192,13 +192,20 @@
 	{
 		$method = 'index';
 	}
-
-	if ( ! method_exists($CI, $method))
-	{
-		show_404();
-	}
 	
-	$CI->$method();
+	if (method_exists($CI, '_remap'))
+	{
+		$CI->_remap($method);
+	}
+	else
+	{
+		if ( ! method_exists($CI, $method))
+		{
+			show_404();
+		}
+	
+		$CI->$method();
+	}
 }
 
 /*
diff --git a/system/codeigniter/Common.php b/system/codeigniter/Common.php
index d5bec77..1b190e2 100644
--- a/system/codeigniter/Common.php
+++ b/system/codeigniter/Common.php
@@ -175,7 +175,7 @@
 							$config['log_threshold'], 
 							$config['log_date_format']
 						);
-	}
+	}	
 	
 	$LOG->write_log($level, $message, $php_error);
 }
diff --git a/system/drivers/DB_active_record.php b/system/drivers/DB_active_record.php
index f1995c8..1320af9 100644
--- a/system/drivers/DB_active_record.php
+++ b/system/drivers/DB_active_record.php
@@ -790,7 +790,7 @@
 			}		
 		}
 		
-		if (ctype_digit($this->ar_limit))
+		if (is_numeric($this->ar_limit))
 		{
 			$sql .= "\n";
 			$sql = $this->_limit($sql, $this->ar_limit, $this->ar_offset);
diff --git a/system/drivers/DB_driver.php b/system/drivers/DB_driver.php
index 0c2084a..5fcb04a 100644
--- a/system/drivers/DB_driver.php
+++ b/system/drivers/DB_driver.php
@@ -352,7 +352,7 @@
 	 */	
 	function escape($str)
 	{	
-		if ( ! ctype_digit($str)) // bug fix to ensure that numbers are not treated as strings.
+		if ( ! is_numeric($str)) // bug fix to ensure that numbers are not treated as strings.
 		{
 			switch (gettype($str))
 			{
diff --git a/system/helpers/date_helper.php b/system/helpers/date_helper.php
index c8205bb..ab3a318 100644
--- a/system/helpers/date_helper.php
+++ b/system/helpers/date_helper.php
@@ -223,7 +223,7 @@
 		return 0;
 	}
 	
-	if ( ! ctype_digit($year) OR strlen($year) != 4)
+	if ( ! is_numeric($year) OR strlen($year) != 4)
 	{
 		$year = date('Y');
 	}
diff --git a/system/helpers/text_helper.php b/system/helpers/text_helper.php
index 15b5573..e4f816e 100644
--- a/system/helpers/text_helper.php
+++ b/system/helpers/text_helper.php
@@ -333,7 +333,7 @@
  */	
 function word_wrap($str, $chars = '76')
 {	
-	if ( ! ctype_digit($chars))
+	if ( ! is_numeric($chars))
 		$chars = 76;
 	
 	$str = preg_replace("/(\r\n|\r|\n)/", "\n", $str);
diff --git a/system/libraries/Email.php b/system/libraries/Email.php
index 96dc001..abc77a5 100644
--- a/system/libraries/Email.php
+++ b/system/libraries/Email.php
@@ -275,7 +275,7 @@
 	 */	
 	function bcc($bcc, $limit = '')
 	{
-		if ($limit != '' && ctype_digit($limit))
+		if ($limit != '' && is_numeric($limit))
 		{
 			$this->bcc_batch_mode = true;
 			$this->bcc_batch_size = $limit;
@@ -475,7 +475,7 @@
 	 */	
 	function set_priority($n = 3)
 	{
-		if ( ! ctype_digit($n))
+		if ( ! is_numeric($n))
 		{
 			$this->priority = 3;
 			return;
diff --git a/system/libraries/Image_lib.php b/system/libraries/Image_lib.php
index 854f048..18e3253 100644
--- a/system/libraries/Image_lib.php
+++ b/system/libraries/Image_lib.php
@@ -291,7 +291,7 @@
 		// Set the quality
 		$this->quality = trim(str_replace("%", "", $this->quality));
 		
-		if ($this->quality == '' OR $this->quality == 0 OR ! ctype_digit($this->quality))
+		if ($this->quality == '' OR $this->quality == 0 OR ! is_numeric($this->quality))
 			$this->quality = 90;
 	
 		// Set the x/y coordinates
diff --git a/system/libraries/Log.php b/system/libraries/Log.php
index de5a9b8..6c78316 100644
--- a/system/libraries/Log.php
+++ b/system/libraries/Log.php
@@ -43,13 +43,13 @@
 	function CI_Log($path = '', $threshold = 4, $date_fmt = '')
 	{	
 		$this->log_path = ($path != '') ? $path : BASEPATH.'logs/';
-
+		
 		if ( ! is_dir($this->log_path) OR ! is_writable($this->log_path))
 		{
 			$this->_enabled = FALSE;
 		}
 		
-		if (ctype_digit($threshold))
+		if (is_numeric($threshold))
 		{
 			$this->_threshold = $threshold;
 		}
@@ -77,7 +77,7 @@
 	function write_log($level = 'error', $msg, $php_error = FALSE)
 	{		
 		if ($this->_enabled === FALSE)
-		{
+		{ 
 			return FALSE;
 		}
 	
diff --git a/system/libraries/Output.php b/system/libraries/Output.php
index 73f0386..7a03cf9 100644
--- a/system/libraries/Output.php
+++ b/system/libraries/Output.php
@@ -78,7 +78,7 @@
 	 */	
 	function cache($time)
 	{
-		$this->cache_expiration = ( ! ctype_digit($time)) ? 0 : $time;
+		$this->cache_expiration = ( ! is_numeric($time)) ? 0 : $time;
 	}
 	
 	// --------------------------------------------------------------------
diff --git a/system/libraries/Pagination.php b/system/libraries/Pagination.php
index 0bbb577..9d558f0 100644
--- a/system/libraries/Pagination.php
+++ b/system/libraries/Pagination.php
@@ -128,7 +128,7 @@
 			$this->cur_page = $obj->uri->segment($this->uri_segment);
 		}
 		
-		if ( ! ctype_digit($this->cur_page))
+		if ( ! is_numeric($this->cur_page))
 		{
 			$this->cur_page = 0;
 		}
diff --git a/system/libraries/Router.php b/system/libraries/Router.php
index 2219f57..1c67113 100644
--- a/system/libraries/Router.php
+++ b/system/libraries/Router.php
@@ -219,15 +219,23 @@
 		{
 			return $segments;
 		}
-		
+
 		// Is the controller in a sub-folder?
 		if (is_dir(APPPATH.'controllers/'.$segments['0']))
-		{
+		{		
 			// Set the directory and remove it from the segment array
 			$this->set_directory($segments['0']);
 			$segments = array_slice($segments, 1);
 			
-			if (count($segments) == 0)
+			if (count($segments) > 0)
+			{
+				// Does the requested controller exist in the sub-folder?
+				if ( ! file_exists(APPPATH.'controllers/'.$this->fetch_directory().$segments['0'].EXT))
+				{
+					show_404();	
+				}
+			}
+			else
 			{
 				$this->set_class($this->default_controller);
 				$this->set_method('index');
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 4f08cf6..94efee5 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -99,7 +99,7 @@
 		 */
 		$expiration = $this->object->config->item('sess_expiration');
 		
-		if (ctype_digit($expiration))
+		if (is_numeric($expiration))
 		{
 			if ($expiration > 0)
 			{
diff --git a/system/libraries/Trackback.php b/system/libraries/Trackback.php
index 583c6d2..8f9680d 100644
--- a/system/libraries/Trackback.php
+++ b/system/libraries/Trackback.php
@@ -368,7 +368,7 @@
 			$tb_array = explode('/', $url);
 			$tb_end   = $tb_array[count($tb_array)-1];
 			
-			if ( ! ctype_digit($tb_end))
+			if ( ! is_numeric($tb_end))
 			{
 				$tb_end  = $tb_array[count($tb_array)-2];
 			}
@@ -386,7 +386,7 @@
 			$tb_array = explode('/', $url);
 			$tb_id	= $tb_array[count($tb_array)-1];
 			
-			if ( ! ctype_digit($tb_id))
+			if ( ! is_numeric($tb_id))
 			{
 				$tb_id  = $tb_array[count($tb_array)-2];
 			}
diff --git a/system/libraries/URI.php b/system/libraries/URI.php
index c5fd462..ba6279e 100644
--- a/system/libraries/URI.php
+++ b/system/libraries/URI.php
@@ -88,7 +88,7 @@
 	 */
 	function uri_to_assoc($n = 3, $default = array())
 	{
-		if ( ! ctype_digit($n))
+		if ( ! is_numeric($n))
 		{
 			return $default;
 		}
@@ -110,7 +110,7 @@
 			{
 				$retval[$val] = FALSE;
 			}		
-			return $default;
+			return $retval;
 		}
 
 		$segments = array_slice($this->segment_array(), ($n - 1));
diff --git a/system/libraries/Validation.php b/system/libraries/Validation.php
index 30faa85..44f49ff 100644
--- a/system/libraries/Validation.php
+++ b/system/libraries/Validation.php
@@ -404,7 +404,7 @@
 	 */	
 	function min_length($str, $val)
 	{
-		if ( ! ctype_digit($val))
+		if ( ! is_numeric($val))
 		{
 			return FALSE;
 		}
@@ -423,7 +423,7 @@
 	 */	
 	function max_length($str, $val)
 	{
-		if ( ! ctype_digit($val))
+		if ( ! is_numeric($val))
 		{
 			return FALSE;
 		}
@@ -442,7 +442,7 @@
 	 */	
 	function exact_length($str, $val)
 	{
-		if ( ! ctype_digit($val))
+		if ( ! is_numeric($val))
 		{
 			return FALSE;
 		}
@@ -517,7 +517,7 @@
 	 */	
 	function numeric($str)
 	{
-		return ( ! ctype_digit($str)) ? FALSE : TRUE;
+		return ( ! is_numeric($str)) ? FALSE : TRUE;
 	}
 	
 	// --------------------------------------------------------------------