--- special_menu_items.module	2010-02-21 12:30:33.000000000 +0000
+++ special_menu_items.module	2010-08-28 15:28:36.000000000 +0000
@@ -87,9 +87,26 @@
  * This function will render link if it is "nolink" or "separator". Otherwise it will call originally
  * overwriten menu_item_link function.
  */
-function special_menu_itemsoverwrite_menu_item_link($link) {
-  $theme_overwrite=variable_get('oldtheme_menu_item_link',null);
-
+function special_menu_itemsoverwrite_menu_item_link($link) {
+  global $theme, $base_theme_info;
+  $base_theme_info = array_reverse($base_theme_info);
+
+  if (function_exists($theme . '_menu_item_link')) {
+    $theme_overwrite = $theme . '_menu_item_link';
+  }
+  else if ($base_theme_info) {
+    foreach ($base_theme_info as $base) {
+      $name = $base->name;
+      if (function_exists($name . '_menu_item_link')) {
+        $theme_overwrite = $name . '_menu_item_link';
+        break;
+      }
+    }
+  }
+  if ($theme_overwrite == '' || !function_exists($theme_overwrite)) {
+    $theme_overwrite = 'theme_menu_item_link';
+  }
+
   if (empty($link['localized_options'])) {
     $link['localized_options'] = array();
   }
