=== modified file 'includes/form.inc'
--- includes/form.inc	
+++ includes/form.inc	
@@ -333,12 +333,9 @@ function form_builder($form_id, $form) {
 
     $posted = (isset($_POST['edit']) && ($_POST['edit']['form_id'] == $form_id));
     $edit = $posted ? $_POST['edit'] : array();
-    $ref =& $form_values;
     foreach ($form['#parents'] as $parent) {
       $edit = isset($edit[$parent]) ? $edit[$parent] : NULL;
-      $ref =& $ref[$parent];
     }
-    $form['#ref'] = &$ref;
     if (!isset($form['#value']) && !array_key_exists('#value', $form)) {
       if ($posted) {
         switch ($form['#type']) {
@@ -402,7 +399,7 @@ function form_builder($form_id, $form) {
   // We call this after #process gets called so that #process has a
   // chance to update #value if desired.
   if (isset($form['#input']) && $form['#input']) {
-    $ref = $form['#value'];
+    $form = form_set_value($form);
   }
 
   // Recurse through all child elements.
@@ -437,6 +434,35 @@ function form_builder($form_id, $form) {
 }
 
 /**
+ * Use this function to preserving changes made in the validate phase 
+ * for the submit phase. If $form['#parents'] is array('foo', 'bar') 
+ * and $form['#value'] is 'baz' then this function makes 
+ * $form_values['foo']['bar'] to be 'baz'. If the second parameter
+ * is 'world' then $form['#value'] becomes 'world', too.
+ *
+ * @param $form
+ *   The form (or a subform). Keys used: #parents, #value
+ */
+function form_set_value($form) {
+  global $form_values;
+  _form_set_value($form_values, $form, $form['#parents'], $form['#value']);
+}
+
+function _form_set_value(&$form_values, $form, $parents, $value) {
+  $parent = array_shift($parents);
+  if (empty($parents)) {
+    $form_values[$parent] = $value;
+  }
+  else {
+    if (!isset($form_values[$parent])) {
+      $form_values[$parent] = array();
+    }
+    _form_set_value($form_values[$parent], $form, $parents, $value);
+  }
+  return $form;
+}
+
+/**
  * Renders a HTML form given a form tree. Recursively iterates over each of
  * the form elements, generating HTML code. This function is usually
  * called from within a theme.  To render a form from within a module, use
@@ -681,14 +707,16 @@ function password_confirm_validate($form
   if (isset($form['pass1']['#value'])) {
     $pass1 = trim($form['pass1']['#value']);
     $pass2 = trim($form['pass2']['#value']);
-    $form['pass1']['#ref'] = NULL;
-    $form['pass2']['#ref'] = NULL;
+    $form['pass1']['#value'] = NULL;
+    $form['pass2']['#value'] = NULL;
+    form_set_value($form['pass1']);
+    form_set_value($form['pass2']);
+    form_set_value($form, $pass1);
     if ($pass1 != $pass2) {
       form_error($form, t('The specified passwords do not match.'));
       form_error($form['pass1']);
       form_error($form['pass2']);
     }
-    $form['#ref'] = $pass1;
   }
   elseif ($form['#required'] && !empty($_POST['edit'])) {
     form_set_error('pass1', t('Password field is required.'));
=== modified file 'modules/node.module'
--- modules/node.module	
+++ modules/node.module	
@@ -2169,7 +2169,7 @@ function node_form_alter($form_id, &$for
  */
 function node_search_validate($form_id, $form_values, $form) {
   // Initialise using any existing basic search keywords.
-  $keys = $form['basic']['inline']['processed_keys']['#ref'];
+  $keys = $form_values['processed_keys'];
 
   // Insert extra restrictions into the search keywords string.
   if (isset($form_values['type']) && is_array($form_values['type'])) {
@@ -2179,6 +2179,7 @@ function node_search_validate($form_id, 
       $keys = search_query_insert($keys, 'type', implode(',', array_keys($form_values['type'])));
     }
   }
+
   if (isset($form_values['category']) && is_array($form_values['category'])) {
     $keys = search_query_insert($keys, 'category', implode(',', $form_values['category']));
   }
@@ -2196,7 +2197,7 @@ function node_search_validate($form_id, 
     $keys .= ' "'. str_replace('"', ' ', $form_values['phrase']) .'"';
   }
   if (!empty($keys)) {
-    $form['basic']['inline']['processed_keys']['#ref'] = trim($keys);
+    form_set_value($form['basic']['inline']['processed_keys'], trim($keys));
   }
 }
 
=== modified file 'modules/search.module'
--- modules/search.module	
+++ modules/search.module	
@@ -1006,7 +1006,7 @@ function search_form($action = '', $keys
  * search form.
  */
 function search_form_validate($form_id, $form_values, $form) {
-  $form['basic']['inline']['processed_keys']['#ref'] = trim($form_values['keys']);
+  form_set_value($form['basic']['inline']['processed_keys'], trim($form_values['keys']));
 }
 
 /**
