diff --git a/database/database.4.0.mysql b/database/database.4.0.mysql
index cb842043d9afe8e21b50072240b297919b2f5025..1247c6e115f691c456e40b8d4a56767cba7312c5 100644
--- a/database/database.4.0.mysql
+++ b/database/database.4.0.mysql
@@ -4,7 +4,7 @@
 -- Table structure for table 'access'
 --
 CREATE TABLE access (
-  aid tinyint(10) NOT NULL auto_increment,
+  aid int(10) NOT NULL auto_increment,
   mask varchar(255) NOT NULL default '',
   type varchar(255) NOT NULL default '',
   status tinyint(2) NOT NULL default '0',
@@ -147,7 +147,7 @@ CREATE TABLE book (
 --
 
 CREATE TABLE boxes (
-  bid tinyint(4) NOT NULL auto_increment,
+  bid int(4) NOT NULL auto_increment,
   title varchar(64) NOT NULL default '',
   body longtext,
   info varchar(128) NOT NULL default '',
diff --git a/database/database.4.1.mysql b/database/database.4.1.mysql
index 7fa9539398da08290b422e766cc4e633e455c24d..e24bc66eda76a29f595ca2344a2db189f25b0972 100644
--- a/database/database.4.1.mysql
+++ b/database/database.4.1.mysql
@@ -4,7 +4,7 @@
 -- Table structure for table 'access'
 --
 CREATE TABLE access (
-  aid tinyint(10) NOT NULL auto_increment,
+  aid int(10) NOT NULL auto_increment,
   mask varchar(255) NOT NULL default '',
   type varchar(255) NOT NULL default '',
   status tinyint(2) NOT NULL default '0',
@@ -157,7 +157,7 @@ DEFAULT CHARACTER SET utf8;
 --
 
 CREATE TABLE boxes (
-  bid tinyint(4) NOT NULL auto_increment,
+  bid int(4) NOT NULL auto_increment,
   title varchar(64) NOT NULL default '',
   body longtext,
   info varchar(128) NOT NULL default '',
diff --git a/database/updates.inc b/database/updates.inc
index b5aeea6c6170d001f442748a5058f8c1492e9c7f..3fe357b34131a9255e0b85f58e78e997ab8b5e13 100644
--- a/database/updates.inc
+++ b/database/updates.inc
@@ -2087,3 +2087,18 @@ function system_update_186() {
 }
 
 
+function system_update_187() {
+  // Increase the size of bid in boxes and aid in access
+  $ret = array();
+  switch ($GLOBALS['db_type']) {
+    case 'mysql':
+    case 'mysqli':
+    $ret[] = update_sql("ALTER TABLE {access} CHANGE `aid` `aid` INT( 10 ) NOT NULL AUTO_INCREMENT ");
+    $ret[] = update_sql("ALTER TABLE {boxes} CHANGE `bid` `bid` INT( 10 ) NOT NULL AUTO_INCREMENT ");
+      break;
+    case 'pgsql':
+      // No database update required for PostgreSQL because it already uses big SERIAL numbers.
+      break;
+  }
+  return $ret;
+}
diff --git a/includes/common.inc b/includes/common.inc
index 79a1d8286a978194783fb00d01e87f0060877f17..e1bda87d137d5d88d87d4c7ed3292d46cfadf3f6 100644
--- a/includes/common.inc
+++ b/includes/common.inc
@@ -1301,7 +1301,7 @@ function drupal_urlencode($text) {
                        urlencode($text));
   }
   else {
-    return str_replace('%2F', '/', urlencode($text));    
+    return str_replace('%2F', '/', urlencode($text));
   }
 }