diff --git a/setup/cli/modules/deploy.php b/setup/cli/modules/deploy.php
index c5100a6a2e74dade52ea39069d8f55022d067579..c616e321f9a2c5ad253b3e8c52e0d1da6eedce9f 100644
--- a/setup/cli/modules/deploy.php
+++ b/setup/cli/modules/deploy.php
@@ -96,7 +96,7 @@ class Deployment extends Unpacker {
         foreach ($this->manifest as $F=>$H)
             $lines[] = "$H $F";
 
-        return file_put_contents($root.'/.MANIFEST', implode("\n", $lines));
+        return file_put_contents($this->include_path.'/.MANIFEST', implode("\n", $lines));
     }
 
     function hashContents($file) {
@@ -223,7 +223,7 @@ class Deployment extends Unpacker {
         $include = ($upgrade) ? $this->get_include_dir()
             : ($options['include'] ? $options['include']
                 : rtrim($this->destination, '/')."/include");
-        $include = rtrim($include, '/').'/';
+        $this->include_path = $include = rtrim($include, '/').'/';
 
         # Locate the upload folder
         $root = $this->source = $this->find_root_folder();
diff --git a/setup/cli/modules/unpack.php b/setup/cli/modules/unpack.php
index 52777b307c4957c24462bf4427449d060dec10db..cc4b9d9d93a4058bfadab56239fd096540004b71 100644
--- a/setup/cli/modules/unpack.php
+++ b/setup/cli/modules/unpack.php
@@ -97,7 +97,7 @@ class Unpacker extends Module {
             return @$this->manifest[$file] ?: null;
 
         $this->manifest = $lines = array();
-        $path = $this->destination . '/.MANIFEST';
+        $path = $this->get_include_dir() . '/.MANIFEST';
         if (!is_file($path))
             return null;
 
@@ -194,7 +194,15 @@ class Unpacker extends Module {
     }
 
     function get_include_dir() {
+        static $location;
+
+        if (isset($location))
+            return $location;
+
         $bootstrap_php = $this->destination . '/bootstrap.php';
+        if (!is_file($bootstrap_php))
+            return @$this->include_path ?: '';
+
         $lines = preg_grep("/define\s*\(\s*'INCLUDE_DIR'/",
             explode("\n", file_get_contents($bootstrap_php)));
 
@@ -203,9 +211,9 @@ class Unpacker extends Module {
         if (!defined('ROOT_DIR'))
             define('ROOT_DIR', rtrim($this->destination, '/').'/');
         foreach ($lines as $line)
-            eval($line);
+            @eval($line);
 
-        return rtrim(INCLUDE_DIR, '/').'/';
+        return $location = rtrim(INCLUDE_DIR, '/').'/';
     }
 
     function run($args, $options) {