diff --git autoload.module autoload.module
index 5afbdc7..76c9998 100644
--- autoload.module
+++ autoload.module
@@ -27,10 +27,11 @@ function autoload_class($class) {
 
    if (!empty($lookup[$class])) {
     // require() is safe because if the file were already included
-    // autoload wouldn't have been triggered.  The dirname() stuff
-    // is backported from Drupal 7 to get an absolute path, which
-    // includes faster on disk.
-    require dirname($_SERVER['SCRIPT_FILENAME']) .'/'. $lookup[$class];
+    // autoload wouldn't have been triggered.
+    $path = realpath($lookup[$class]);
+    if (!empty($path)) {
+      require $path;
+    }
   }
 }
 
