diff --git a/system/application/config/config.php b/system/application/config/config.php
index c19fabf..7b19b83 100644
--- a/system/application/config/config.php
+++ b/system/application/config/config.php
@@ -78,7 +78,7 @@
 | setting this variable to TRUE (boolean).  See the user guide for details.
 |
 */
-$config['enable_hooks'] = TRUE;
+$config['enable_hooks'] = FALSE;
 
 
 /*
diff --git a/system/drivers/DB_driver.php b/system/drivers/DB_driver.php
index 3a2a5e9..0c2084a 100644
--- a/system/drivers/DB_driver.php
+++ b/system/drivers/DB_driver.php
@@ -36,6 +36,7 @@
 	var $database;
 	var $dbdriver		= 'mysql';
 	var $dbprefix		= '';
+	var $port			= '';
 	var $pconnect		= FALSE;
 	var $conn_id		= FALSE;
 	var $result_id		= FALSE;
@@ -75,7 +76,7 @@
 	{	
 		if (is_array($params))
 		{
-			foreach (array('hostname' => '', 'username' => '', 'password' => '', 'database' => '', 'dbdriver' => 'mysql', 'dbprefix' => '', 'pconnect' => FALSE, 'db_debug' => FALSE) as $key => $val)
+			foreach (array('hostname' => '', 'username' => '', 'password' => '', 'database' => '', 'dbdriver' => 'mysql', 'dbprefix' => '', 'port' => '', 'pconnect' => FALSE, 'db_debug' => FALSE) as $key => $val)
 			{
 				$this->$key = ( ! isset($params[$key])) ? $val : $params[$key];
 			}
diff --git a/system/drivers/DB_postgre.php b/system/drivers/DB_postgre.php
index fd98ec7..673dea3 100644
--- a/system/drivers/DB_postgre.php
+++ b/system/drivers/DB_postgre.php
@@ -38,9 +38,11 @@
 	 */	
 	function db_connect()
 	{
-		return pg_connect("host=".$this->hostname." dbname=".$this->database." user=".$this->username." password=".$this->password);
+		$port = ($this->port == '') ? '' : " port=".$this->port;
+		
+		return pg_connect("host=".$this->hostname.$port." dbname=".$this->database." user=".$this->username." password=".$this->password);
 	}
-	
+
 	// --------------------------------------------------------------------
 
 	/**
@@ -51,7 +53,9 @@
 	 */	
 	function db_pconnect()
 	{
-		return pg_pconnect("host=".$this->hostname." dbname=".$this->database." user=".$this->username." password=".$this->password);
+		$port = ($this->port == '') ? '' : " port=".$this->port;
+
+		return pg_pconnect("host=".$this->hostname.$port." dbname=".$this->database." user=".$this->username." password=".$this->password);
 	}
 	
 	// --------------------------------------------------------------------
diff --git a/system/helpers/file_helper.php b/system/helpers/file_helper.php
index 93bddb0..32c0b2c 100644
--- a/system/helpers/file_helper.php
+++ b/system/helpers/file_helper.php
@@ -75,9 +75,9 @@
  * @param	string	file data
  * @return	bool
  */	
-function write_file($path, $data)
+function write_file($path, $data, $mode = 'wb')
 {
-	if ( ! $fp = @fopen($path, 'wb'))
+	if ( ! $fp = @fopen($path, $mode))
 	{
 		return FALSE;
 	}
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 03d6c3b..09169e3 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -56,7 +56,7 @@
 function base_url()
 { 
 	$obj =& get_instance();
-	return $obj->config->item('base_url', 1);
+	return $obj->config->slash_item('base_url');
 }
 	
 // ------------------------------------------------------------------------
diff --git a/system/libraries/Output.php b/system/libraries/Output.php
index f5db3e0..73f0386 100644
--- a/system/libraries/Output.php
+++ b/system/libraries/Output.php
@@ -147,7 +147,7 @@
 			return;
 		}
 		
-		$uri =	$obj->config->item('base_url', 1).
+		$uri =	$obj->config->slash_item('base_url').
 				$obj->config->item('index_page').
 				$obj->uri->uri_string();