Index: logotool.module
===================================================================
--- logotool.module	(revision 51)
+++ logotool.module	(working copy)
@@ -279,10 +279,16 @@
 } // logotool_delete_submit
 
 function logotool_fetch_matches() {
+  $path = drupal_lookup_path('source', substr($_SERVER['REQUEST_URI'], 1));
+  $path = $path ? $path : substr($_SERVER['REQUEST_URI'], 1);
+  if (empty($path)) {
+    // $path is empty, so it must be the home page
+    $path = variable_get('site_frontpage', 'node');
+  }
   foreach (explode("\n", variable_get('logotool_pages', '')) as $page) {
     $explode = explode("|", $page);
     $regexp = '/^('. preg_replace(array('/(\r\n?|\n)/', '/\\\\\*/', '/(^|\|)\\\\<front\\\\>($|\|)/'), array('|', '.*', '\1'. preg_quote(variable_get('site_frontpage', 'node'), '/') .'\2'), preg_quote($explode[0], '/')) .')$/';
-    preg_match($regexp, substr($_SERVER['REQUEST_URI'], 1), $match);
+    preg_match($regexp, $path, $match);
     if ($match) {
       return $explode[1];
     }
