diff --git a/mysql-test/r/insert.result b/mysql-test/r/insert.result
index d019cfcbfa94e7886e9a0805c66c709c57f3d60a..ebcb7721822cc3bbc4a67a1e21e83028a09c09d0 100644
--- a/mysql-test/r/insert.result
+++ b/mysql-test/r/insert.result
@@ -65,7 +65,7 @@ insert into t1 values (1), (NULL), (2);
 select * from t1;
 id
 1
-8
+0
 2
 drop table t1;
 drop database if exists foo;
diff --git a/sql/field_conv.cc b/sql/field_conv.cc
index ce67455881b68dafa24bdd29e88f436c9fa4394d..db0cc71c6bf7f8d719ddddfe6f68f2d4ccc68512 100644
--- a/sql/field_conv.cc
+++ b/sql/field_conv.cc
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
+/* Copyright (C) 2000-2003 MySQL AB
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -118,7 +118,7 @@ set_field_to_null(Field *field)
     field->reset();
     return 0;
   }
-  field->set_default();
+  field->reset();
   if (current_thd->count_cuted_fields)
   {
     current_thd->cuted_fields++;		// Increment error counter
@@ -170,7 +170,7 @@ set_field_to_null_with_conversions(Field *field, bool no_conversions)
     ((Field_timestamp*) field)->set_time();
     return 0;					// Ok to set time to NULL
   }
-  field->set_default();
+  field->reset();
   if (field == field->table->next_number_field)
     return 0;					// field is set in handler.cc
   if (current_thd->count_cuted_fields)
diff --git a/sql/item_strfunc.cc b/sql/item_strfunc.cc
index 995d413626c23188ba2e68ef446adc2654a3cf71..d18436d2c61f8e74d17e105023ad3df5daa43438 100644
--- a/sql/item_strfunc.cc
+++ b/sql/item_strfunc.cc
@@ -1546,13 +1546,11 @@ double Item_func_elt::val()
     return 0.0;
 
   double result= args[tmp-1]->val();
-  if (args[tmp-1]->is_null())
-    return 0.0;
-
-  null_value=0;
+  null_value= args[tmp-1]->null_value;
   return result;
 }
 
+
 longlong Item_func_elt::val_int()
 {
   uint tmp;
@@ -1561,13 +1559,11 @@ longlong Item_func_elt::val_int()
     return 0;
   
   int result= args[tmp-1]->val_int();
-  if (args[tmp-1]->is_null())
-    return 0;
-
-  null_value=0;
+  null_value= args[tmp-1]->null_value;
   return result;
 }
 
+
 String *Item_func_elt::val_str(String *str)
 {
   uint tmp;
@@ -1576,10 +1572,7 @@ String *Item_func_elt::val_str(String *str)
     return NULL;
 
   String *result= args[tmp-1]->val_str(str);
-  if (args[tmp-1]->is_null())
-    return NULL;
-
-  null_value=0;
+  null_value= args[tmp-1]->null_value;
   return result;
 }
 
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index 5704ce6e4329f5e59374f1617e49598a17bdde96..2d949810b63185876b8884c6d3af7ba1da53d221 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -2409,7 +2409,11 @@ QUICK_SELECT *get_quick_select_for_ref(TABLE *table, TABLE_REF *ref)
   if (!quick)
     return 0;
   if (cp_buffer_from_ref(ref))
-    return quick; /* empty range */
+  {
+    if (current_thd->fatal_error)
+      return 0;					// End of memory
+    return quick;				// empty range
+  }
 
   QUICK_RANGE *range= new QUICK_RANGE();
   if (!range)