diff --git a/system/database/DB.php b/system/database/DB.php
index f7476a6..6223744 100644
--- a/system/database/DB.php
+++ b/system/database/DB.php
@@ -24,8 +24,6 @@
  */
 function DB($params = '', $return = FALSE, $active_record = FALSE)
 {
-	$obj =& get_instance();
-
 	// Do we even need to load the database class?
 	if (class_exists('CI_DB') AND $return == FALSE AND $active_record == FALSE)
 	{
@@ -92,8 +90,9 @@
 	{
 		return $DB;
 	}
-	
-	$obj->db =& $DB;
+
+	$CI =& get_instance();	
+	$CI->db =& $DB;
 }