diff --git modules/node/node.module modules/node/node.module
index bafb54f..5c06466 100644
--- modules/node/node.module
+++ modules/node/node.module
@@ -1002,17 +1002,15 @@ function node_validate($node, $form, &$form_state) {
  * Prepare node for saving by populating author and creation date.
  */
 function node_submit($node) {
-  global $user;
 
   // A user might assign the node author by entering a user name in the node
   // form, which we then need to translate to a user ID.
-  if (isset($node->name)) {
-    if ($account = user_load_by_name($node->name)) {
-      $node->uid = $account->uid;
-    }
-    else {
-      $node->uid = 0;
-    }
+  // If not, the node is assigned to Anonymous (uid=0)
+  if (!empty($node->name) && ($account = user_load_by_name($node->name))) {
+    $node->uid = $account->uid;
+  }
+  else {
+    $node->uid = 0;
   }
 
   $node->created = !empty($node->date) ? strtotime($node->date) : REQUEST_TIME;
