diff --git a/myisam/mi_info.c b/myisam/mi_info.c
index 958c881158d459c43b849f6485b4e034f11875cf..078ce4042e82a5ea0bd1cae23a363a317047e6d6 100644
--- a/myisam/mi_info.c
+++ b/myisam/mi_info.c
@@ -57,7 +57,6 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
     x->index_file_length=info->state->key_file_length;
 
     x->keys	 	= share->state.header.keys;
-    x->key_map	 	= share->state.key_map;
     x->check_time	= share->state.check_time;
     x->mean_reclength	= info->state->records ?
       (ulong) (info->state->data_file_length-info->state->empty)/
@@ -87,6 +86,7 @@ int mi_status(MI_INFO *info, register MI_ISAMINFO *x, uint flag)
     x->raid_type= share->base.raid_type;
     x->raid_chunks= share->base.raid_chunks;
     x->raid_chunksize= share->base.raid_chunksize;
+    x->key_map	 	= share->state.key_map;
   }
   if ((flag & HA_STATUS_TIME) && !my_fstat(info->dfile,&state,MYF(0)))
     x->update_time=state.st_mtime;
diff --git a/scripts/safe_mysqld.sh b/scripts/safe_mysqld.sh
index 11d17f822eee6c7b9ea0924ba1bcc89f21a2ea73..0265dcdeeb9ed515da2792d1e5a68c0aa8e66eff 100644
--- a/scripts/safe_mysqld.sh
+++ b/scripts/safe_mysqld.sh
@@ -149,8 +149,10 @@ then
   fi
 fi
 
+USER=""
 if test -w /
 then
+  USER_OPTION="--user=$user"
   # If we are root, change the err log to the right user.
   touch $err_log; chown $user $err_log
   if test -n "$open_files"
@@ -211,9 +213,9 @@ do
   rm -f $MYSQL_UNIX_PORT $pid_file	# Some extra safety
   if test -z "$args"
   then
-    $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
+    $NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ >> $err_log 2>&1
   else
-    eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR --user=$user --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
+    eval "$NOHUP_NICENESS $ledir/$MYSQLD $defaults --basedir=$MY_BASEDIR_VERSION --datadir=$DATADIR $USER_OPTION --pid-file=$pid_file @MYSQLD_DEFAULT_SWITCHES@ $args >> $err_log 2>&1"
   fi
   if test ! -f $pid_file		# This is removed if normal shutdown
   then
diff --git a/sql/ha_berkeley.cc b/sql/ha_berkeley.cc
index 8dbf15068b56c6e61e2d3814f70bc21750d40417..28a33c6a99e4e73e663f76f4c0ccc2edd423ca25 100644
--- a/sql/ha_berkeley.cc
+++ b/sql/ha_berkeley.cc
@@ -796,7 +796,8 @@ int ha_berkeley::write_row(byte * record)
   else
   {
     DB_TXN *sub_trans = transaction;
-    ulong thd_options = table->in_use->options;
+    /* Don't use sub transactions in temporary tables (in_use == 0) */
+    ulong thd_options = table->in_use ? table->in_use->options : 0;
     for (uint retry=0 ; retry < berkeley_trans_retry ; retry++)
     {
       key_map changed_keys = 0;
@@ -1014,7 +1015,7 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
   DBT prim_key, key, old_prim_key;
   int error;
   DB_TXN *sub_trans;
-  ulong thd_options = table->in_use->options;
+  ulong thd_options = table->in_use ? table->in_use->options : 0;
   bool primary_key_changed;
   DBUG_ENTER("update_row");
 
@@ -1112,23 +1113,6 @@ int ha_berkeley::update_row(const byte * old_row, byte * new_row)
 	  break;
 	}
       }
-#ifdef BROKEN_CODE_HERE
-      int new_error;
-      DBUG_PRINT("error",("Got error %d",error));
-      if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
-      {
-	DBUG_PRINT("trans",("aborting subtransaction"));
-        new_error=txn_abort(sub_trans);
-      }
-      else if (changed_keys)
-	new_error=restore_keys(changed_keys, primary_key,
-			       old_row, old_prim_key, new_row, prim_key);
-      if (new_error)
-      {
-	error=new_error;			// This shouldn't happen
-	break;
-      }
-#endif
     }
     else if (using_ignore && (thd_options & OPTION_INTERNAL_SUBTRANSACTIONS))
     {
@@ -1227,7 +1211,7 @@ int ha_berkeley::delete_row(const byte * record)
   int error;
   DBT row, prim_key;
   key_map keys=table->keys_in_use;
-  ulong thd_options = table->in_use->options;
+  ulong thd_options = table->in_use ? table->in_use->options : 0;
   DBUG_ENTER("delete_row");
   statistic_increment(ha_delete_count,&LOCK_status);
 
diff --git a/sql/mysql_priv.h b/sql/mysql_priv.h
index 6ce43d6a5601794f94a5415efef4a038b0594e64..8afdbdc67eb2f37fec521e21237bc87f430f1ae6 100644
--- a/sql/mysql_priv.h
+++ b/sql/mysql_priv.h
@@ -164,7 +164,7 @@ void kill_one_thread(THD *thd, ulong id);
 #define OPTION_INTERNAL_SUBTRANSACTIONS OPTION_QUOTE_SHOW_CREATE*2
 
 /* Set if we are updating a non-transaction safe table */
-#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_QUOTE_SHOW_CREATE*2
+#define OPTION_STATUS_NO_TRANS_UPDATE OPTION_INTERNAL_SUBTRANSACTIONS*2
 
 /* The following is set when parsing the query */
 #define QUERY_NO_INDEX_USED		OPTION_STATUS_NO_TRANS_UPDATE*2
diff --git a/sql/mysqld.cc b/sql/mysqld.cc
index b788c8d122c7c8f97489b0f65b964883429b3a0a..b915f3692a15bf62c0e4200bc9e3c836e3e89916 100644
--- a/sql/mysqld.cc
+++ b/sql/mysqld.cc
@@ -1120,8 +1120,8 @@ terribly wrong\n");
 	    *(ebp+17) : *(ebp+1));
     if (new_ebp <= ebp )
     {
-      fprintf(stderr, "New value of ebp failed sanity check\
-terminating backtrace\n");
+      fprintf(stderr, "\
+New value of ebp failed sanity check terminating backtrace\n");
       return;
     }
     ebp = new_ebp;