diff --git a/setup/cli/modules/deploy.php b/setup/cli/modules/deploy.php
index 8fc0e142bcbd7e0485291a10f333c0f3f0a6e7ed..d307e51f2616e34ab378689b1993111b3b81eaa5 100644
--- a/setup/cli/modules/deploy.php
+++ b/setup/cli/modules/deploy.php
@@ -35,7 +35,7 @@ class Deployment extends Unpacker {
             if (is_file($start . '/main.inc.php')) break;
             $start .= '/..';
         }
-        return Misc::realpath($start);
+        return self::realpath($start);
     }
 
     /**
@@ -92,7 +92,7 @@ class Deployment extends Unpacker {
         if (!is_dir($this->destination))
             if (!@mkdir($this->destination, 0751, true))
                 die("Destination path does not exist and cannot be created");
-        $this->destination = Misc::realpath($this->destination).'/';
+        $this->destination = self::realpath($this->destination).'/';
 
         # Determine if this is an upgrade, and if so, where the include/
         # folder is currently located
diff --git a/setup/cli/modules/unpack.php b/setup/cli/modules/unpack.php
index 3411c94eb6c102d94e0dd2d29c8fac9c66e2a0fa..af5cfd6247079facfcbf6215819475f0417be120 100644
--- a/setup/cli/modules/unpack.php
+++ b/setup/cli/modules/unpack.php
@@ -34,6 +34,10 @@ class Unpacker extends Module {
              main installation path.",
     );
 
+    function realpath($path) {
+        return ($p = realpath($path)) ? $p : $path;
+    }
+
     function find_upload_folder() {
         # Hop up to the root folder
         $start = dirname(__file__);
@@ -41,7 +45,7 @@ class Unpacker extends Module {
             if (is_dir($start . '/upload')) break;
             $start .= '/..';
         }
-        return Misc::realpath($start.'/upload');
+        return self::realpath($start.'/upload');
     }
 
     function change_include_dir($include_path) {