diff --git includes/session.inc includes/session.inc
index d86d72e..46c20c1 100644
--- includes/session.inc
+++ includes/session.inc
@@ -168,10 +168,13 @@ function _drupal_session_write($sid, $value) {
     $last_read = &drupal_static('drupal_session_last_read');
     $is_changed = !isset($last_read) || $last_read['sid'] != $sid || $last_read['value'] !== $value;
 
     // For performance reasons, do not update the sessions table, unless
     // $_SESSION has changed or more than 180 has passed since the last update.
+    if (!isset($user->timestamp)) {
+      $user->timestamp = 0;
+    }
     if ($is_changed || REQUEST_TIME - $user->timestamp > variable_get('session_write_interval', 180)) {
       // Either ssid or sid or both will be added from $key below.
       $fields = array(
         'uid' => $user->uid,
         'cache' => isset($user->cache) ? $user->cache : 0,
