diff --git a/client.inc.php b/client.inc.php
index 00c63a1f93757e6d47021088c746a33cb6656d15..f8f6ddff1e0cab8dd8a8e047138b0b3974eced85 100644
--- a/client.inc.php
+++ b/client.inc.php
@@ -15,7 +15,7 @@
 **********************************************************************/
 if(!strcasecmp(basename($_SERVER['SCRIPT_NAME']),basename(__FILE__))) die('kwaheri rafiki!');
 
-$thisdir=str_replace('\\\\', '/', realpath(dirname(__FILE__))).'/'; 
+$thisdir=str_replace('\\', '/', realpath(dirname(__FILE__))).'/';
 if(!file_exists($thisdir.'main.inc.php')) die('Fatal Error.');
 
 require_once($thisdir.'main.inc.php');
diff --git a/include/class.osticket.php b/include/class.osticket.php
index d481ee60c7e694f40e8b0369c6544873b8e1c876..239c921139229938c18cf3519b5ce095748ce2a4 100644
--- a/include/class.osticket.php
+++ b/include/class.osticket.php
@@ -386,7 +386,8 @@ class osTicket {
          * What's left is the ROOT_PATH.
          */
         $frame = array_pop(debug_backtrace(false));
-        $path = substr($frame['file'], strlen(ROOT_DIR));
+        $file = str_replace('\\','/', $frame['file']);
+        $path = substr($file, strlen(ROOT_DIR));
         if($path && ($pos=strpos($_SERVER['SCRIPT_NAME'], $path))!==false)
             return substr($_SERVER['SCRIPT_NAME'], 0, $pos);
 
diff --git a/include/class.pdf.php b/include/class.pdf.php
index f210149346c7d36d561bdca8bc3fb9ad59771226..ba020c2bc2e0ab1a2990f9a4644cb386f4266660 100644
--- a/include/class.pdf.php
+++ b/include/class.pdf.php
@@ -14,7 +14,7 @@
     vim: expandtab sw=4 ts=4 sts=4:
 **********************************************************************/
 
-define('THIS_DIR', str_replace('\\\\', '/', realpath(dirname(__FILE__))) . '/'); //Include path..
+define('THIS_DIR', str_replace('\\', '/', realpath(dirname(__FILE__))) . '/'); //Include path..
 define('FPDF_DIR', THIS_DIR . 'fpdf/');
 define('FPDF_FONTPATH', FPDF_DIR . 'font/'); //fonts directory.
 require (FPDF_DIR . 'fpdf.php');
diff --git a/main.inc.php b/main.inc.php
index ce874b26cb6920ff9e08fdcf9e1ce22e143cbd96..5a43ad3d45f442ab7ed673c4587a656026423392 100644
--- a/main.inc.php
+++ b/main.inc.php
@@ -60,7 +60,7 @@
     }
 
     #Set Dir constants
-    define('ROOT_DIR',str_replace('\\\\', '/', realpath(dirname(__FILE__))).'/'); #Get real path for root dir ---linux and windows
+    define('ROOT_DIR',str_replace('\\', '/', realpath(dirname(__FILE__))).'/'); #Get real path for root dir ---linux and windows
     define('INCLUDE_DIR',ROOT_DIR.'include/'); //Change this if include is moved outside the web path.
     define('PEAR_DIR',INCLUDE_DIR.'pear/');
     define('SETUP_DIR',INCLUDE_DIR.'setup/');