--- pathologic.module	Sun Feb 26 13:43:27 2012
+++ pathologic.module	Sun Mar 18 17:24:48 2012
@@ -135,7 +135,7 @@
     // Give up by "replacing" the original with the same.
     return $matches[0];
   }
-  
+
   // Let's also bail out of this doesn't look like a local path.
   $found = FALSE;
   // Cycle through local paths and find one with a host and a path that matches;
@@ -231,16 +231,27 @@
   if (strpos($parts['path'], '/') === 0) {
     $parts['path'] = substr($parts['path'], 1);
   }
-  $langs = language_list();
-  $url = url(
-    $parts['path'] === '' ? '<front>' : $parts['path'],
-    array(
-      'query' => $parts['qparts'],
-      'fragment' => isset($parts['fragment']) ? $parts['fragment'] : NULL,
-      'absolute' => $settings['current_settings']['absolute'],
-      'language' => isset($langs[$settings['langcode']]) ? $langs[$settings['langcode']] : NULL,
-    )
+  $url_options = array(
+    'query' => $parts['qparts'],
+    'absolute' => $settings['current_settings']['absolute'],
   );
+  if (isset($parts['fragment'])) {
+    $url_options['fragment'] = $parts['fragment'];
+  }
+  if (!empty($settings['langcode'])) {
+    if ($settings['langcode'] !== LANGUAGE_NONE) {
+      $langs = language_list();
+      if (isset($langs[$settings['langcode']])) {
+        $url_options['language'] = isset($langs[$settings['langcode']]);
+      }
+    }
+    else {
+      global $language_url;
+      $url_options['language'] = clone $language_url;
+      $url_options['language']->prefix = '';
+    }
+  }
+  $url = url($parts['path'], $url_options);
   // $matches[1] will be the tag attribute; src, href, etc.
   return "{$matches[1]}=\"{$url}";
 }
