diff --git includes/bootstrap.inc includes/bootstrap.inc
index d58b4ea..368b48e 100644
--- includes/bootstrap.inc
+++ includes/bootstrap.inc
@@ -1308,9 +1308,12 @@ function watchdog($type, $message, $variables = array(), $severity = WATCHDOG_NO
 
   static $in_error_state = FALSE;
 
-  // It is possible that the error handling will itself trigger an error. In that case, we could
-  // end up in an infinite loop. To avoid that, we implement a simple static semaphore.
-  if (!$in_error_state) {
+  // It is possible that the error handling will itself trigger an error. In
+  // that case, we could end up in an infinite loop. To avoid that, we
+  // implement a simple static semaphore.  In addition, watchdog may be called
+  // by the error or exception handles very early in bootstrap before module.inc
+  // has been included, so we must check for it.
+  if (!$in_error_state && function_exists('module_implements')) {
     $in_error_state = TRUE;
 
     // Prepare the fields to be logged
diff --git includes/errors.inc includes/errors.inc
index 42bd3a1..f1a9891 100644
--- includes/errors.inc
+++ includes/errors.inc
@@ -125,6 +125,30 @@ function _drupal_decode_exception($exception) {
   );
 }
 
+
+/**
+ * Minimal substitute for t() when it is not available..
+ */
+function _drupal_error_t($string, $args = array()) {
+  // Transform arguments before inserting them
+  foreach ($args as $key => $value) {
+    switch ($key[0]) {
+      // Escaped only
+      case '@':
+        $args[$key] = check_plain($value);
+        break;
+      // Escaped and placeholder
+      case '%':
+      default:
+        $args[$key] = '<em>' . check_plain($value) . '</em>';
+        break;
+      // Pass-through
+      case '!':
+    }
+  }
+  return strtr((!empty($locale_strings[$string]) ? $locale_strings[$string] : $string), $args);
+}
+
 /**
  * Log a PHP error or exception, display an error page in fatal cases.
  *
@@ -143,6 +167,12 @@ function _drupal_log_error($error, $fatal = FALSE) {
     }
     drupal_maintenance_theme();
   }
+  if (function_exists('t')) {
+    $t = 't';
+  }
+  else {
+    $t = '_drupal_error_t';
+  }
 
   // When running inside the testing framework, we relay the errors
   // to the tested site by the way of HTTP headers.
@@ -178,7 +208,7 @@ function _drupal_log_error($error, $fatal = FALSE) {
   if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') {
     if ($fatal) {
       // When called from JavaScript, simply output the error message.
-      print t('%type: %message in %function (line %line of %file).', $error);
+      print $t('%type: %message in %function (line %line of %file).', $error);
       exit;
     }
   }
@@ -197,14 +227,14 @@ function _drupal_log_error($error, $fatal = FALSE) {
         $class = 'status';
       }
 
-      drupal_set_message(t('%type: %message in %function (line %line of %file).', $error), $class);
+      drupal_set_message($t('%type: %message in %function (line %line of %file).', $error), $class);
     }
 
     if ($fatal) {
       drupal_set_title(t('Error'));
       // We fallback to a maintenance page at this point, because the page generation
       // itself can generate errors.
-      print theme('maintenance_page', array('content' => t('The website encountered an unexpected error. Please try again later.')));
+      print theme('maintenance_page', array('content' => $t('The website encountered an unexpected error. Please try again later.')));
       exit;
     }
   }
diff --git modules/system/image.gd.inc modules/system/image.gd.inc
index ebfdcf2..75c53ab 100644
--- modules/system/image.gd.inc
+++ modules/system/image.gd.inc
@@ -244,7 +244,7 @@ function image_gd_load(stdClass $image) {
  * @param $image
  *   An image object.
  * @param $destination
- *   A string file path where the image should be saved.
+ *   A string file URI where the image should be saved.
  * @param $extension
  *   A string containing one of the following extensions: gif, jpg, jpeg, png.
  * @return
@@ -253,9 +253,18 @@ function image_gd_load(stdClass $image) {
  * @see image_save()
  */
 function image_gd_save(stdClass $image, $destination) {
-  // Convert URI to a normal path because PHP apparently has some gaps in stream wrapper support.
+  $tempnam = '';
   if ($wrapper = file_stream_wrapper_get_instance_by_uri($destination)) {
-    $destination = $wrapper->realpath();
+    $parents = class_parents($wrapper);
+    if (empty($parents['DrupalLocalStreamWrapper'])) {
+      // Use a temp file as an intermediate step for a remote URI.
+      $tempwrapper = file_stream_wrapper_get_instance_by_scheme('temporary');
+      $tempnam = tempnam($tempwrapper->getDirectoryPath(), 'gd_');
+    }
+    else {
+      // Convert URI to a normal path because PHP apparently has some gaps in stream wrapper support.
+      $destination = $wrapper->realpath();
+    }
   }
 
   $extension = str_replace('jpg', 'jpeg', $image->info['extension']);
@@ -272,6 +281,13 @@ function image_gd_save(stdClass $image, $destination) {
       imagealphablending($image->resource, FALSE);
       imagesavealpha($image->resource, TRUE);
     }
+    if ($tempnam) {
+      // Use a temp file as an intermediate step.
+      if ($function($image->resource, $tempnam)) {
+        return (bool) file_unmanaged_move($tempnam, $destination, FILE_EXISTS_REPLACE);
+      }
+      return FALSE;
+    }
     return $function($image->resource, $destination);
   }
 }
