diff --git a/include/class.osticket.php b/include/class.osticket.php
index cca754b4ef160f2d33370118ec55a8e7165fd768..f23dc824c68c541fd2799259cd4c5acdc954f794 100644
--- a/include/class.osticket.php
+++ b/include/class.osticket.php
@@ -18,7 +18,6 @@
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
 
-require_once(INCLUDE_DIR.'class.config.php'); //Config helper
 require_once(INCLUDE_DIR.'class.csrf.php'); //CSRF token class.
 require_once(INCLUDE_DIR.'class.migrater.php');
 
@@ -49,6 +48,8 @@ class osTicket {
 
     function osTicket() {
 
+        require_once(INCLUDE_DIR.'class.config.php'); //Config helper
+
         $this->session = osTicketSession::start(SESSION_TTL); // start DB based session
 
         $this->config = new OsticketConfig();
@@ -387,7 +388,7 @@ class osTicket {
 
         // Not chrooted
         if(strpos($dir, $root)!==false)
-            return substr($dir, strlen($dir));
+            return substr($dir, strlen($root));
 
         // Chrooted ?
         $path = '';
diff --git a/include/class.yaml.php b/include/class.yaml.php
index d21605ca0b0cb04d178b36f38c7cf34cf0f5d253..fc340d70abc0153b3e3f8071b8981c3da17f5cbc 100644
--- a/include/class.yaml.php
+++ b/include/class.yaml.php
@@ -23,6 +23,7 @@
 **********************************************************************/
 
 require_once "Spyc.php";
+require_once "class.error.php";
 
 class YamlDataParser {
     /* static */