Index: uspace/lib/ext4/libext4_directory.c
===================================================================
--- uspace/lib/ext4/libext4_directory.c	(revision aaedababad6930ee2866dd131358aaff881aa879)
+++ uspace/lib/ext4/libext4_directory.c	(revision ab779280d0b8fd72a86dda613351189bb8eb38f0)
@@ -328,17 +328,9 @@
 		}
 
-		for (p = entries; p < entries + count; ++p) {
-			EXT4FS_DBG("hash = \%u && block = \%u", ext4_directory_dx_entry_get_hash(p), ext4_directory_dx_entry_get_block(p));
-		}
-
 		p = entries + 1;
 		q = entries + count - 1;
 
-		EXT4FS_DBG("hash = \%u", hinfo->hash);
-
 		while (p <= q) {
 			m = p + (q - p) / 2;
-			EXT4FS_DBG("p = \%x, q = \%x, m = \%x", (uint32_t)p, (uint32_t)q, (uint32_t)m);
-			EXT4FS_DBG("node hash = \%u", ext4_directory_dx_entry_get_hash(m));
 			if (ext4_directory_dx_entry_get_hash(m) > hinfo->hash) {
 				q = m - 1;
@@ -411,23 +403,18 @@
 		}
 
-		if (name_len == ext4_directory_entry_ll_get_name_length(sb, dentry)) {
-
-			if (bcmp((uint8_t *)name, dentry->name, name_len) == 0) {
-				// TODO check entry ??
-				EXT4FS_DBG("found entry name = \%s", dentry->name);
-				*block_offset = offset;
-				*res_entry = dentry;
-				return 1;
+		if (dentry->inode != 0) {
+			if (name_len == ext4_directory_entry_ll_get_name_length(sb, dentry)) {
+				// Compare names
+				if (bcmp((uint8_t *)name, dentry->name, name_len) == 0) {
+					*block_offset = offset;
+					*res_entry = dentry;
+					return 1;
+				}
 			}
 		}
+
 
 		// Goto next entry
 		dentry_len = ext4_directory_entry_ll_get_entry_length(dentry);
-
-		uint16_t nl = ext4_directory_entry_ll_get_name_length(sb, dentry);
-		dentry->name[nl] = 0;
-
-//		EXT4FS_DBG("dentry_len = \%u",(uint32_t)dentry_len);
-		EXT4FS_DBG("dentry_name = \%s", dentry->name);
 
         if (dentry_len == 0) {
@@ -475,6 +462,4 @@
 
     current_hash = ext4_directory_dx_entry_get_hash(p->position);
-
-    EXT4FS_DBG("hash = \%u, curr = \%u", hash, current_hash);
 
     if ((hash & 1) == 0) {
@@ -521,5 +506,4 @@
 	ext4_directory_dx_handle_t handles[2], *handle;
 
-
 	// get direct block 0 (index root)
 	rc = ext4_filesystem_get_inode_data_block_index(fs, inode_ref->inode, 0, &root_block_addr);
@@ -548,6 +532,4 @@
 	do {
 
-		EXT4FS_DBG("pos = \%u", (uint32_t)handle->position);
-
 		leaf_block_idx = ext4_directory_dx_entry_get_block(handle->position);
 
@@ -557,6 +539,4 @@
     	}
 
-    	EXT4FS_DBG("bloxk = \%u", leaf_block_idx);
-
 		rc = block_get(&leaf_block, fs->device, leaf_block_addr, BLOCK_FLAGS_NONE);
 		if (rc != EOK) {
@@ -566,6 +546,4 @@
 		rc = ext4_dirextory_dx_find_dir_entry(leaf_block, fs->superblock, len, name,
 				&res_dentry, &block_offset);
-
-		EXT4FS_DBG("entry \%s", rc == 1 ? "found" : "not found");
 
 		// Found => return it
@@ -593,10 +571,7 @@
 		}
 
-		EXT4FS_DBG("can\%s continue", rc == 1 ? "" : "not");
-
 	} while (rc == 1);
 
-	// TODO return ENOENT;
-	return EXT4_ERR_BAD_DX_DIR;
+	return ENOENT;
 }
 
Index: uspace/lib/ext4/libext4_hash.c
===================================================================
--- uspace/lib/ext4/libext4_hash.c	(revision aaedababad6930ee2866dd131358aaff881aa879)
+++ uspace/lib/ext4/libext4_hash.c	(revision ab779280d0b8fd72a86dda613351189bb8eb38f0)
@@ -49,4 +49,5 @@
 #define H(x, y, z) ((x) ^ (y) ^ (z))
 
+
 /*
  * The generic round function.  The application is so specific that
@@ -62,5 +63,5 @@
 
 
-static void tea_transform(uint32_t buf[4],uint32_t const in[])
+static void tea_transform(uint32_t buf[4], uint32_t const in[])
 {
 	uint32_t sum = 0;
@@ -233,5 +234,11 @@
     int i;
     uint32_t in[8], buf[4];
-    bool unsigned_version = false;
+    void (*str2hashbuf)(const char *, int, uint32_t *, int) = str2hashbuf_signed;
+
+    /*
+    for (i = 0; i < 8; ++i) {
+    	in[i] = 0;
+    }
+    */
 
     /* Initialize the default seed for the hash checksum functions */
@@ -247,7 +254,7 @@
             	break;
 			}
-			if (i < 4) {
-				memcpy(buf, hinfo->seed, sizeof(buf));
-			}
+		}
+		if (i < 4) {
+			memcpy(buf, hinfo->seed, sizeof(buf));
 		}
     }
@@ -264,14 +271,10 @@
 
 		case EXT4_HASH_VERSION_HALF_MD4_UNSIGNED:
-			unsigned_version = true;
+			str2hashbuf = str2hashbuf_unsigned;
 
 		case EXT4_HASH_VERSION_HALF_MD4:
 			p = name;
 			while (len > 0) {
-				if (unsigned_version) {
-					str2hashbuf_unsigned(p, len, in, 8);
-				} else {
-					str2hashbuf_signed(p, len, in, 8);
-				}
+				(*str2hashbuf)(p, len, in, 8);
 				half_md4_transform(buf, in);
 				len -= 32;
@@ -284,14 +287,10 @@
 
 		case EXT4_HASH_VERSION_TEA_UNSIGNED:
-			unsigned_version = true;
+			str2hashbuf = str2hashbuf_unsigned;
 
 		case EXT4_HASH_VERSION_TEA:
 			p = name;
 			while (len > 0) {
-				if (unsigned_version) {
-					str2hashbuf_unsigned(p, len, in, 4);
-				} else {
-					str2hashbuf_signed(p, len, in, 4);
-				}
+				(*str2hashbuf)(p, len, in, 4);
 				tea_transform(buf, in);
 				len -= 16;
@@ -311,4 +310,5 @@
 		hash = (EXT4_DIRECTORY_HTREE_EOF-1) << 1;
 	}
+
 	hinfo->hash = hash;
 	hinfo->minor_hash = minor_hash;
