diff --git a/patches/patch20240127-8.0-SNAPSHOT/patch.sql b/patches/patch20240127-8.0-SNAPSHOT/patch.sql
index 02faf660a17973a333034a4007c521969da4b0b5..90669e50276967ddb7d1ad87dd50c3511114ecf7 100644
--- a/patches/patch20240127-8.0-SNAPSHOT/patch.sql
+++ b/patches/patch20240127-8.0-SNAPSHOT/patch.sql
@@ -1,10 +1,5 @@
 -- USE _caosdb_schema_unit_tests;
 
-
--- REMOVE SQLITE datatype (obsolete)
-DELETE FROM name_data WHERE entity_id = 50;
-DELETE FROM entities WHERE id = 50;
-
 /*
 -- Create file_hashes table.
 -- This table is necessary because not all FSO objects have hashes (e.g.
@@ -69,6 +64,7 @@ ALTER TABLE entities MODIFY COLUMN `role` enum('RECORDTYPE','RECORD','FILE','_RE
 -- Add a new special role "DIRECTORY"
 INSERT IGNORE INTO entities (id, description, role, acl) VALUES (9, "The directory role.", "ROLE", 0);
 INSERT IGNORE INTO name_data (domain_id, entity_id, property_id, value, status, pidx) VALUES (0, 9, 20, "DIRECTORY", "FIX", 0);
+INSERT IGNORE INTO entity_ids (id, internal_id) VALUES (9,9);
 
 -- In the default file storage back-end the key is just the path.
 UPDATE files SET file_key=path;
@@ -91,6 +87,7 @@ ALTER TABLE archive_files MODIFY COLUMN path VARCHAR(16000) NOT NULL;
 -- Add a special nameless directory which is used as the root directory of the
 -- internal file system.
 INSERT IGNORE INTO entities (id, description, role, acl) VALUES (51, "The root directory of the internal files system", "DIRECTORY", 0);
+INSERT IGNORE INTO entity_ids (id, internal_id) VALUES (51,51);
 INSERT IGNORE INTO files
     (file_id, path, checked_timestamp, mimetype, file_storage_id,
         file_key, parent_directory)
diff --git a/procedures/getDependentEntities.sql b/procedures/getDependentEntities.sql
index 8472c5ebe9efc115f24641543fcefeefc908d308..908095e96ccb9cc71a79f6aacc88fcdf3848d935 100644
--- a/procedures/getDependentEntities.sql
+++ b/procedures/getDependentEntities.sql
@@ -78,7 +78,7 @@ BEGIN
     INSERT IGNORE INTO referring (id) SELECT entity_id FROM date_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
     INSERT IGNORE INTO referring (id) SELECT domain_id FROM date_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
 
-    INSERT IGNORE INTO refering (id) SELECT file_id FROM files WHERE parent_directory=InternalEntityID;
+    INSERT IGNORE INTO referring (id) SELECT file_id FROM files WHERE parent_directory=InternalEntityID;
 
     INSERT IGNORE INTO referring (id) SELECT entity_id FROM null_data WHERE property_id=InternalEntityID AND domain_id=0 AND entity_id!=InternalEntityID;
     INSERT IGNORE INTO referring (id) SELECT domain_id FROM null_data WHERE property_id=InternalEntityID AND domain_id!=InternalEntityID AND entity_id!=InternalEntityID AND domain_id!=0;
diff --git a/procedures/insertEntity.sql b/procedures/insertEntity.sql
index 00de4f76163bf5073b74371196d9a8492e999e4c..ab0723af6f2e21a4ba8dc8b81207cf7c8367f9e8 100644
--- a/procedures/insertEntity.sql
+++ b/procedures/insertEntity.sql
@@ -87,7 +87,7 @@ BEGIN
             VALUES (0, InternalEntityID, 20, EntityName, "FIX", 0);
     END IF;
 
-    SELECT Version as Version;
+    SELECT Version as Version, InternalEntityID as InternalEntityID;
 
 END;
 //
diff --git a/procedures/insertFSODescriptor.sql b/procedures/insertFSODescriptor.sql
index 09c916f267879b72e353ec3dbd9aaa46a6f0f932..597ebafc4fd298b204c8b43cc478c97397b3c8e0 100644
--- a/procedures/insertFSODescriptor.sql
+++ b/procedures/insertFSODescriptor.sql
@@ -80,7 +80,7 @@ insertFSODescriptorBody: BEGIN
             file_storage_id,
             file_key,
             parent_directory
-        ) VALUES (InternalEntityID, unhex(FileHash), FileHashAlgo, FileCheckedTimestamp, FileSize, FilePath, FileMimeType, FileStorageId, FileKey, FileParentID);
+        ) VALUES (InternalEntityID, unhex(FileHash), FileHashAlgo, FileCheckedTimestamp, FileSize, FilePath, FileMimeType, FileStorageId, FileKey, InternalParentID);
 
 END;
 //
diff --git a/procedures/listFSODescriptorByParentDirectory.sql b/procedures/listFSODescriptorByParentDirectory.sql
index 600fffafaecb7aa1ff09ec8bff5f1577d038d06d..430d8861c60000fd84086eecc2f3c5b215fa8052 100644
--- a/procedures/listFSODescriptorByParentDirectory.sql
+++ b/procedures/listFSODescriptorByParentDirectory.sql
@@ -38,12 +38,15 @@ DROP PROCEDURE IF EXISTS db_5_0.listFSODescriptorByParentDirectory //
  *            FileHashChecked, FileMimeType, FileStorageID, FileKey)
  */
 CREATE PROCEDURE db_5_0.listFSODescriptorByParentDirectory(
-    IN ParentDirectory INT UNSIGNED)
+    IN ParentDirectory VARCHAR(255))
 listFSODescriptorByParentDirectoryBody: BEGIN
+    DECLARE InternalParentID INT UNSIGNED DEFAULT NULL;
+
+    SELECT internal_id INTO InternalParentID from entity_ids WHERE id = ParentDirectory;
 
     SELECT hash_algorithm AS FileHashAlgo,
-            file_id AS FileId,
-            parent_directory AS FileParentID,
+            (SELECT id FROM entity_ids WHERE internal_id = file_id) AS FileId,
+            ParentDirectory AS FileParentID,
             path AS FilePath,
             size AS FileSize,
             hex(hash) AS FileHash,
@@ -52,7 +55,7 @@ listFSODescriptorByParentDirectoryBody: BEGIN
             file_storage_id AS FileStorageID,
             file_key AS FileKey
         FROM files
-        WHERE parent_directory = ParentDirectory;
+        WHERE parent_directory = InternalParentID;
 
 END;
 //