--- globalredirect.module.orig	2008-08-04 16:40:16.000000000 +0200
+++ globalredirect.module	2008-08-29 12:54:37.000000000 +0200
@@ -79,7 +79,12 @@ function globalredirect_init() {
     $alias = drupal_get_path_alias($request);
 
     // Compare the request to the alias. If we have a language prefix then prefix the alias and compare. This also works as a 'deslashing' agent too
-    if ((empty($language->prefix) ? $alias : $language->prefix .'/'. $alias) != $_REQUEST['q']) {
+    $options = array('prefix' => '');
+    if (function_exists('language_url_rewrite')) {
+      language_url_rewrite($alias, $options);
+    }
+    $prefix = empty($alias) ? rtrim($options['prefix'], '/') : $options['prefix'];
+    if ($prefix . $alias != $_REQUEST['q']) {
       drupal_goto($alias, $query_string, NULL, 301);
     }
 
