diff --git a/src/66/66-parser.c b/src/66/66-parser.c
index 0efef9d9b55098fff44d0c10198a3493dd95ff4b..4bf607de84386bbdfc521e095fd795222917428c 100644
--- a/src/66/66-parser.c
+++ b/src/66/66-parser.c
@@ -55,11 +55,6 @@ static inline void info_help (void)
 static void check_dir(char const *dir,uint8_t force,int main)
 {
 	int r ;
-	size_t dirlen = strlen(dir) ;
-	char tmp[dirlen+1] ;
-	if (!dirname(tmp,dir)) strerr_diefu1x(111,"set directory name") ;
-	char name[dirlen+1] ;
-	if (!basename(name,dir)) strerr_diefu1x(111,"set name") ;
 	
 	r = scan_mode(dir,S_IFDIR) ;
 	if (r < 0){ errno = ENOTDIR ; strerr_dief2sys(111,"conflicting format of: ",dir) ; }
@@ -71,7 +66,7 @@ static void check_dir(char const *dir,uint8_t force,int main)
 	}
 	else if (r && !force && main) strerr_dief3x(111,"destination: ",dir," already exist") ;
 	if (!r)
-		if (!dir_create_under(tmp,name, 0755)) strerr_diefu2sys(111,"create: ",dir) ;
+		if (!dir_create_parent(dir, 0755)) strerr_diefu2sys(111,"create: ",dir) ;
 }
 
 int main(int argc, char const *const *argv,char const *const *envp)
diff --git a/src/66/66-scandir.c b/src/66/66-scandir.c
index 5db01545bfee9e542034c20f840caf61f9384755..9bf80bf053293be572c6e4064a748a83dbe33383 100644
--- a/src/66/66-scandir.c
+++ b/src/66/66-scandir.c
@@ -265,15 +265,13 @@ void write_bootlog(char const *live, char const *scandir)
 	 * /run/66/log*/
 	memcpy(path,live,livelen) ;
 	memcpy(path+livelen,"log",3) ;
-	path[livelen + 3] = 0 ;
-	log_perm(log_user,&uid,&gid) ;
-	VERBO3 strerr_warnt4x("create directory: ",path,"/",OWNERSTR) ;
-	r = dir_create_under(path,OWNERSTR,02750) ;
-	if (r < 0) strerr_diefu3sys(111,"create: ",path,OWNERSTR) ;
-	/** chown /run/66/log/<uid>*/
 	path[livelen + 3] = '/' ;
 	memcpy(path + livelen + 4,OWNERSTR,ownerlen) ;
 	path[livelen + 4 + ownerlen] = 0 ;
+	VERBO3 strerr_warnt2x("create directory: ",path) ;
+	r = dir_create_parent(path,02750) ;
+	if (!r) strerr_diefu2sys(111,"create: ",path) ;
+	log_perm(log_user,&uid,&gid) ;
 	if (chown(path,uid,gid) < 0)
 		strerr_diefu2sys(111,"chown: ",path) ;
 	auto_chmod(path,02755) ;
diff --git a/src/lib66/resolve.c b/src/lib66/resolve.c
index 7ef0d716f9db9ce8c18b9ce95c5f9f8fe5dfe728..ac59b5e55c1947717f1e7c404ea4b9577366fd2b 100644
--- a/src/lib66/resolve.c
+++ b/src/lib66/resolve.c
@@ -975,16 +975,18 @@ int ss_resolve_create_live(ssexec_t *info)
 	if (!r)
 	{
 		ssize_t len = get_rlen_until(sares.s,'/',sares.len) ;
-	
-		char sym[sares.len + SS_RESOLVE_LEN + 1] ;
-		memcpy(sym,sares.s,len) ;
-		sym[len] = 0 ;
-		r = dir_create_under(sym,info->treename.s,0700) ;
+		sares.len-- ;
+		char sym[sares.len + SS_SVDIRS_LEN + 1] ;
+		memcpy(sym,sares.s,sares.len) ;
+		sym[sares.len] = 0 ;
+		
+		r = dir_create_parent(sym,0700) ;
 		if (!r) goto err ;
+		sym[len] = 0 ;
 		if (chown(sym,info->owner,gidowner) < 0) goto err ;
-		memcpy(sym,sares.s,sares.len - 1) ;
-		memcpy(sym + (sares.len - 1), SS_SVDIRS, SS_SVDIRS_LEN) ;
-		sym[(sares.len - 1) + SS_SVDIRS_LEN] = 0 ;
+		memcpy(sym,sares.s,sares.len) ;
+		memcpy(sym + sares.len, SS_SVDIRS, SS_SVDIRS_LEN) ;
+		sym[sares.len + SS_SVDIRS_LEN] = 0 ;
 		
 		VERBO3 strerr_warnt4x("point symlink: ",sym," to ",ressrc.s) ;
 		if (symlink(ressrc.s,sym) < 0)
diff --git a/src/lib66/tree_switch_current.c b/src/lib66/tree_switch_current.c
index 1ef0c4df6081f61ff2b89c9b5ee159da8ce42371..fbc076d69ee39c66cbfa5c66700644c0c23c052f 100644
--- a/src/lib66/tree_switch_current.c
+++ b/src/lib66/tree_switch_current.c
@@ -16,7 +16,6 @@
  
 #include <sys/types.h>
 #include <string.h>
-
 #include <sys/stat.h>
 
 #include <oblibs/error2.h>
@@ -39,36 +38,37 @@ int tree_switch_current(char const *base, char const *treename)
 	size_t treelen = strlen(treename) ;
 	size_t newlen ;
 	size_t packlen ;
-	char dst[baselen + SS_TREE_CURRENT_LEN + treelen + 2 + 1] ;
-	struct stat st ;
-		
 	packlen = uint_fmt(pack,MYUID) ;
 	pack[packlen] = 0 ;
-
+	char dst[baselen + SS_TREE_CURRENT_LEN + 1 + packlen + treelen + 2 + 1] ;
+	struct stat st ;
+		
 	memcpy(dst,base,baselen) ;
 	memcpy(dst + baselen,SS_SYSTEM,SS_SYSTEM_LEN) ;
-	dst[baselen + SS_SYSTEM_LEN] = 0 ;
-	
-	r = dir_search(dst,treename,S_IFDIR) ;
+	dst[baselen + SS_SYSTEM_LEN] = '/' ;
+	memcpy(dst + baselen + SS_SYSTEM_LEN + 1,treename,treelen) ;
+	dst[baselen + SS_SYSTEM_LEN + 1 + treelen] = 0 ;
+
+	r = scan_mode(dst,S_IFDIR) ;
 	if (r <= 0) return 0 ;
 
 	memcpy(dst + baselen,SS_TREE_CURRENT,SS_TREE_CURRENT_LEN) ;
-	newlen = baselen + SS_TREE_CURRENT_LEN ;
+	dst[baselen + SS_TREE_CURRENT_LEN] = '/' ;
+	memcpy(dst + baselen + SS_TREE_CURRENT_LEN + 1, pack, packlen) ;
+	newlen = baselen + SS_TREE_CURRENT_LEN + 1 + packlen ;
 	dst[newlen] = 0 ;
 	
-	r = dir_search(dst,pack,S_IFDIR) ;
+	r = scan_mode(dst,S_IFDIR) ;
 	if (!r){
-		if (!dir_create_under(dst,pack,0755)) return 0 ;
+		if (!dir_create_parent(dst,0755)) return 0 ;
 	}
-	if(r < 0) return 0 ;
+	if(r == -1) return 0 ;
 	
-	char current[newlen + 1 + packlen + 1 + SS_TREE_CURRENT_LEN + 1] ;
+	char current[newlen + 1 + SS_TREE_CURRENT_LEN + 1] ;
 	memcpy(current,dst,newlen) ;
 	current[newlen] = '/' ;
-	memcpy(current + newlen + 1, pack,packlen) ;
-	current[newlen + 1 + packlen] = '/' ;
-	memcpy(current + newlen + 1 + packlen + 1, SS_TREE_CURRENT, SS_TREE_CURRENT_LEN) ;
-	current[newlen + 1 + packlen + 1 + SS_TREE_CURRENT_LEN] = 0 ;
+	memcpy(current + newlen + 1, SS_TREE_CURRENT, SS_TREE_CURRENT_LEN) ;
+	current[newlen + 1 + SS_TREE_CURRENT_LEN] = 0 ;
 	 
 	memcpy(dst + baselen,SS_SYSTEM,SS_SYSTEM_LEN) ;
 	memcpy(dst + baselen + SS_SYSTEM_LEN,"/",1) ;