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;
 	}
 	
 	// --------------------------------------------------------------------