Index: kernel/classes/ezcontentobjecttreenode.php
===================================================================
--- kernel/classes/ezcontentobjecttreenode.php	(revision 21407)
+++ kernel/classes/ezcontentobjecttreenode.php	(working copy)
@@ -2943,10 +2943,8 @@
         $nodeDepth = $this->attribute( 'depth' );
 
         $childrensPath = $nodePath ;
-        $pathLength = strlen( $childrensPath );
 
         $db = eZDB::instance();
-        $subStringString = $db->subString( 'path_string', 1, $pathLength );
         $pathString = " path_string like '$childrensPath%' and ";
         $depthCond = '';
         $nodeDepth = $this->Depth + 1;
@@ -3114,7 +3112,6 @@
         $nodePath =  $node->attribute( 'path_string' );
 
         $sectionID =(int) $sectionID;
-//        $subStringString = $db->subString( 'path_string', 1, strlen( $nodePath ) );
 
         $pathString = " path_string like '$nodePath%' AND ";
 
@@ -4053,13 +4050,9 @@
 
         $nodePath = $this->attribute( 'path_string' );
         $childrensPath = $nodePath ;
-        $pathLength = strlen( $childrensPath );
 
         $pathString = " path_string like '$childrensPath%' ";
 
-
-        $subStringString = $db->subString( 'path_string', 1, $pathLength );
-
         $urlAlias = $this->attribute( 'url_alias' );
 
         // Remove static cache
@@ -4487,10 +4480,8 @@
         }
 
         $childPath = $nodePath;
-        $pathLength = strlen( $childPath );
 
         $db = eZDB::instance();
-        $subStringString = $db->subString( 'path_string', 1, $pathLength );
         $pathString = " ezcot.path_string like '$childPath%' and ";
 
         $notEqParentString = "ezcot.node_id != $fromNode";
@@ -4580,19 +4571,26 @@
                           WHERE
                                  node_id = $nodeID";
             $db = eZDB::instance();
-            $subStringString = $db->subString( 'path_string', 1, $oldPathLength );
-            $subStringString2 =  $db->subString( 'path_string', $oldPathLength );
+            $subStringString =  $db->subString( 'path_string', $oldPathLength );
+            $newPathString   = $db->concatString( array( "'$newPath'" , "'$nodeID'", $subStringString ) );
             $moveQuery1 = "UPDATE
                                  ezcontentobject_tree
                            SET
-                                 path_string = " . $db->concatString( array( "'$newPath'" , "'$nodeID'",$subStringString2 ) ) . " ,
+                                 path_string = $newPathString,
+                                 depth = depth + $newParentDepth - $oldDepth + 1
+                           WHERE
+                                 path_string like '$childrensPath%'";
+            $moveQuery2 = "UPDATE
+                                 ezcontentobject_tree
+                           SET
+                                 path_string = $newPathString,
                                  depth = depth + $newParentDepth - $oldDepth + 1
                            WHERE
-                                 $subStringString = '$childrensPath' OR
-                                 path_string = '$oldPath' ";
+                                 path_string = '$oldPath'";
             $db->begin();
             $db->query( $moveQuery );
             $db->query( $moveQuery1 );
+            $db->query( $moveQuery2 );
 
         /// role system clean up
         // Clean up policies and limitations
@@ -4603,8 +4601,7 @@
                 //include_once( "kernel/classes/ezrole.php" );
                 $limitationIDString = implode( ',', $limitationsToFix );
                 $limitationIDString = " limitation_id in ( $limitationIDString ) ";
-                $subStringString = $db->subString( 'value', 1, $oldPathLength );
-                $subStringString2 =  $db->subString( 'value', $oldPathLength );
+                $subStringString =  $db->subString( 'value', $oldPathLength );
 
                 $query = "UPDATE
                                  ezpolicy_limitation_value
@@ -4609,9 +4606,9 @@
                 $query = "UPDATE
                                  ezpolicy_limitation_value
                           SET
-                                 value = " . $db->concatString( array( "'$newPath'" , "'$nodeID'",$subStringString2 ) ) . "
+                                 value = " . $db->concatString( array( "'$newPath'" , "'$nodeID'",$subStringString ) ) . "
                           WHERE
-                                ( $subStringString = '$childrensPath' OR
+                                ( value like '$childrensPath%' OR
                                  value = '$oldPath' ) AND  $limitationIDString";
 
                 $db->query( $query );
Index: kernel/search/plugins/ezsearchengine/ezsearchengine.php
===================================================================
--- kernel/search/plugins/ezsearchengine/ezsearchengine.php	(revision 21407)
+++ kernel/search/plugins/ezsearchengine/ezsearchengine.php	(working copy)
@@ -767,10 +767,7 @@
                     foreach ( $nodeArray as $node )
                     {
                         $pathString = $node['path_string'];
-
-                        $subStringString = $db->subString( 'ezcontentobject_tree.path_string', 1, strlen( $pathString ) );
-
-                        $subTreeSQL .= " $subStringString = '$pathString' ";
+                        $subTreeSQL .= " ezcontentobject_tree.path_string like '$pathString%' ";
 
                         if ( $i < ( count( $nodeArray ) -1 ) )
                             $subTreeSQL .= " OR ";
