diff --git a/CHANGELOG.md b/CHANGELOG.md
index cc36c949648c9fb41391e01636d63ad307cf7f48..00bb1c4b0834fe35c3bbb3f96235e679a00d7310 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -9,14 +9,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 
 ### Added ###
 
+* Added a `_get_head_iversion` for non-api usage.
+
 ### Changed ###
 
+* Added a `versioned` flag to the following procedures:
+    * `applyBackReference`
+    * `applyIDFilter`
+    * `applyPOV`
+    * `applyRefPOV`
+    * `makeStmt`
+    * `calcComplementUnion`
+    * `calcDifference`
+    * `calcIntersection`
+    * `finishSubProperty`
+    * `getChildren`
+    * `initEmptyTargetSet`
+    * `initDisjunctionFilter`
+    * `initEntity`
+    * `initQuery`
+    * `createTmpTable`
+* Added a `direct` column to `archive_isa` table
+
 ### Deprecated ###
 
 ### Removed ###
 
+* unused procedures:
+    * `initNegationFilter`
+    * `initDisjunctionFilter`
+    * `initConjunctionFilter`
+    * `finishNegationFilter`
+
 ### Fixed ###
 
+* Semi-fix in `retrieveEntityParents`. The old implementation was buggy and
+  would return no parent name or even a wrong one for old entity versions in
+  some cases. The semi-fix will allways return the current name of the parent
+  (even if this is historically not always correct). A real fix awaits the
+  implementation of versioned isa-relations which is already planned.
 * Bug in `retrieveOverrides` function where selecting the datatype of an old
   version resultet in an error. See corresponding test in `caosdb-pyinttest`
   `tests/test_versioning.py::test_datatype_without_name`
diff --git a/patches/patch20201110-3.0.0-rc3/patch.sh b/patches/patch20201110-4.0.0-rc1/patch.sh
similarity index 92%
rename from patches/patch20201110-3.0.0-rc3/patch.sh
rename to patches/patch20201110-4.0.0-rc1/patch.sh
index 2b737587b24508e1c2d5817ff26155b2636a5316..56f3e42b01a510476ff28e4f3d4a13909449ee2e 100755
--- a/patches/patch20201110-3.0.0-rc3/patch.sh
+++ b/patches/patch20201110-4.0.0-rc1/patch.sh
@@ -23,9 +23,8 @@
 #
 # ** end header
 #
-# new entity_version table
-# Update mysql schema to version v3.0.0-rc3
-NEW_VERSION="v3.0.0-rc3"
+# Update mysql schema to version v4.0.0-rc1
+NEW_VERSION="v4.0.0-rc1"
 OLD_VERSION="v3.0.0-rc2"
 
 if [ -z "$UTILSPATH" ]; then
diff --git a/patches/patch20201110-3.0.0-rc3/update_archive_isa.sql b/patches/patch20201110-4.0.0-rc1/update_archive_isa.sql
similarity index 82%
rename from patches/patch20201110-3.0.0-rc3/update_archive_isa.sql
rename to patches/patch20201110-4.0.0-rc1/update_archive_isa.sql
index d256b76015ae2e7b5b2a510a8eca7cce21a82f93..9beaa857a28ec520a26b6e912e7ce0c9b918b76e 100644
--- a/patches/patch20201110-3.0.0-rc3/update_archive_isa.sql
+++ b/patches/patch20201110-4.0.0-rc1/update_archive_isa.sql
@@ -18,7 +18,10 @@
  * along with this program. If not, see <https://www.gnu.org/licenses/>.
  */
 
--- Create tables for versioning.
+-- remove unused procedures
+DROP PROCEDURE IF EXISTS db_2_0.initNegationFilter;
+DROP PROCEDURE IF EXISTS db_2_0.initConjunctionFilter;
+DROP PROCEDURE IF EXISTS db_2_0.finishNegationFilter;
 
 ALTER TABLE archive_isa
     ADD COLUMN `direct` BOOLEAN DEFAULT TRUE;
diff --git a/procedures/query/applyPOV.sql b/procedures/query/applyPOV.sql
index e7d0029661f7a7d74a5a8a8b4f819b56281edce5..9bf89c7d083c3b195cd2551f4097ff1d046a6879 100644
--- a/procedures/query/applyPOV.sql
+++ b/procedures/query/applyPOV.sql
@@ -198,9 +198,8 @@ POV_LABEL: BEGIN
 
 
 
+    call createTmpTable(keepTabl, versioned);
     IF versioned THEN
-        call createVersionedTmpTable(keepTabl);
-
         #-- generate statement from statement parts
         SET @stmtPOVkeepTblStr = CONCAT("INSERT IGNORE INTO `", keepTabl, "` (id, _iversion) SELECT entity_id AS id, _iversion FROM ", data, " as data", IF(propertiesTable IS NULL, '', CONCAT(' WHERE EXISTS (Select 1 from `', propertiesTable, '` AS prop WHERE prop.id = data.property_id AND (prop.id2=data.entity_id OR prop.id2=0))')));
 
@@ -236,8 +235,6 @@ POV_LABEL: BEGIN
         DEALLOCATE PREPARE stmt3;
         DEALLOCATE PREPARE stmtPOVkeepTbl;
     ELSE
-        call createTmpTable(keepTabl);
-
         #-- generate statement from statement parts
         SET @stmtPOVkeepTblStr = CONCAT("INSERT IGNORE INTO `", keepTabl, "` (id) SELECT DISTINCT entity_id AS id FROM ", data, " as data", IF(propertiesTable IS NULL, '', CONCAT(' WHERE EXISTS (Select 1 from `', propertiesTable, '` AS prop WHERE prop.id = data.property_id AND (prop.id2=data.entity_id OR prop.id2=0))')));
 
diff --git a/procedures/query/createTmpTable.sql b/procedures/query/createTmpTable.sql
index a14f07c9c0b6c5568b0dfebfe12a90576b257b78..b0564c894a1dbb862a06d246c0f7e6ce8e617325 100644
--- a/procedures/query/createTmpTable.sql
+++ b/procedures/query/createTmpTable.sql
@@ -36,13 +36,20 @@ DROP PROCEDURE IF EXISTS db_2_0.createTmpTable;
 DELIMITER //
 
 /**
- * Creates a temporary table for query results with only a single ID column.
+ * If not versioned: Creates a temporary table for query results with only a single `id` column.
+ *
+ * If versioned: Creates a temporary table for query results with an `id`
+ * column and an `_iversion` column.
  */
-CREATE PROCEDURE db_2_0.createTmpTable(out newTableName VARCHAR(255))
+CREATE PROCEDURE db_2_0.createTmpTable(out newTableName VARCHAR(255), in versioned BOOLEAN)
 BEGIN
     call registerTempTableName(newTableName);
 
-    SET @createTableStmtStr = CONCAT('CREATE TEMPORARY TABLE `', newTableName,'` ( id INT UNSIGNED PRIMARY KEY)' );
+    IF versioned THEN
+        SET @createTableStmtStr = CONCAT('CREATE TEMPORARY TABLE `', newTableName,'` ( id INT UNSIGNED, _iversion INT UNSIGNED, PRIMARY KEY (id, _iversion))' );
+    ELSE
+        SET @createTableStmtStr = CONCAT('CREATE TEMPORARY TABLE `', newTableName,'` ( id INT UNSIGNED PRIMARY KEY)' );
+    END IF;
 
     PREPARE createTableStmt FROM @createTableStmtStr; 
     EXECUTE createTableStmt;
@@ -75,26 +82,3 @@ END;
 //
 
 DELIMITER ;
-
-
-DROP PROCEDURE IF EXISTS db_2_0.createVersionedTmpTable;
-DELIMITER //
-
-/**
- * Creates a temporary table for query results with an id column and an
- * _iversion column.
- */
-CREATE PROCEDURE db_2_0.createVersionedTmpTable(out newTableName VARCHAR(255))
-BEGIN
-    call registerTempTableName(newTableName);
-
-    SET @createTableStmtStr = CONCAT('CREATE TEMPORARY TABLE `', newTableName,'` ( id INT UNSIGNED, _iversion INT UNSIGNED, PRIMARY KEY (id, _iversion))' );
-
-    PREPARE createTableStmt FROM @createTableStmtStr; 
-    EXECUTE createTableStmt;
-    DEALLOCATE PREPARE createTableStmt;
-END;
-//
-
-DELIMITER ;
-
diff --git a/procedures/query/initBackReference.sql b/procedures/query/initBackReference.sql
index 11283fe6fcc5a9aa9e05d995039ff0c3aab1cc21..63fa9292a71688a7a53f8851bb5a375e1aa76fe0 100644
--- a/procedures/query/initBackReference.sql
+++ b/procedures/query/initBackReference.sql
@@ -29,12 +29,14 @@ BEGIN
     DECLARE entitiesTable VARCHAR(255) DEFAULT NULL;
 
     IF pname IS NOT NULL THEN
-        call createTmpTable(propertiesTable);
+        -- TODO versioning for properties
+        call createTmpTable(propertiesTable, FALSE);
         call initSubEntity(pid, pname, propertiesTable);
     END IF;
 
     IF ename IS NOT NULL THEN
-        call createTmpTable(entitiesTable);
+        -- TODO versioning for referencing entities
+        call createTmpTable(entitiesTable, FALSE);
         call initSubEntity(entity_id, ename, entitiesTable);
     END IF;
 
diff --git a/procedures/query/initDisjunctionFilter.sql b/procedures/query/initDisjunctionFilter.sql
index 54e8c70ca771cd7bf9207166f29d1c47b0c2aff8..be7a0ebad9d3f9b278a4ea7de5418ade1b627f31 100644
--- a/procedures/query/initDisjunctionFilter.sql
+++ b/procedures/query/initDisjunctionFilter.sql
@@ -36,18 +36,10 @@ BEGIN
         EXECUTE stmtIsNotEmpty;
         DEALLOCATE PREPARE stmtIsNotEmpty;
         IF @isNotEmptyVar IS NOT NULL THEN /*if targetSet is not empty*/
-            IF versioned THEN
-                call createVersionedTmpTable(newTableName);
-            ELSE
-                call createTmpTable(newTableName);
-            END IF;
+            call createTmpTable(newTableName, versioned);
         END IF;
     ELSE
-        IF versioned THEN
-            call createVersionedTmpTable(newTableName);
-        ELSE
-            call createTmpTable(newTableName);
-        END IF;
+        call createTmpTable(newTableName, versioned);
     END IF;
     SELECT newTableName AS newTableName;
 END;
@@ -63,50 +55,3 @@ BEGIN
 END;
 //
 DELIMITER ;
-
-DROP PROCEDURE IF EXISTS db_2_0.initNegationFilter;
--- Apparently this code is not used anymore
--- DELIMITER //
-
--- CREATE PROCEDURE db_2_0.initNegationFilter(in sourceSet VARCHAR(255), in versioned BOOLEAN)
--- BEGIN
-    -- DECLARE newTableName VARCHAR(255) DEFAULT NULL;
-    -- if versioned THEN
-        -- call createVersionedTmpTable(newTableName);
-    -- ELSE
-        -- call createTmpTable(newTableName);
-    -- END IF;
-    -- call copyTable(sourceSet, newTableName);
-    -- SELECT newTableName AS newTableName;
--- END;
--- //
--- DELIMITER ;
-
-DROP PROCEDURE IF EXISTS db_2_0.initConjunctionFilter;
--- Apparently this code is not used anymore
--- DELIMITER //
-
--- CREATE PROCEDURE db_2_0.initConjunctionFilter(in sourceSet VARCHAR(255))
--- BEGIN
-    -- DECLARE newTableName VARCHAR(255) DEFAULT NULL;
-    -- call createTmpTable(newTableName);
-    -- call copyTable(sourceSet, newTableName);
-    -- SELECT newTableName AS newTableName;
--- END;
--- //
--- DELIMITER ;
-
-DROP PROCEDURE IF EXISTS db_2_0.finishNegationFilter;
--- Apparently this code is not used anymore
--- DELIMITER //
-
--- CREATE PROCEDURE db_2_0.finishNegationFilter(in sourceSet VARCHAR(255), in targetSet VARCHAR(255), in subResultSet VARCHAR(255), in versioned BOOLEAN)
--- BEGIN
-    -- IF targetSet IS NULL OR sourceSet = targetSet THEN
-        -- call calcDifference(sourceSet, subResultSet, versioned);
-    -- ELSE
-        -- call calcComplementUnion(targetSet,subResultSet,sourceSet, versioned);
-    -- END IF;
--- END;
--- // 
--- DELIMITER ;
diff --git a/procedures/query/initPOV.sql b/procedures/query/initPOV.sql
index 27a063a7c3159b5f4530610b8c740f4fb65ec76f..76f2d8c6df5a771eb3f4fe994e6f7a83fead36e2 100644
--- a/procedures/query/initPOV.sql
+++ b/procedures/query/initPOV.sql
@@ -97,7 +97,8 @@ BEGIN
 
     #-- for reference properties: the value is interpreted as a record type name.
     IF vText IS NOT NULL THEN
-        call createTmpTable(refIdsTable);
+        -- TODO versioned queries
+        call createTmpTable(refIdsTable, FALSE);
         call initSubEntity(vInt, vText, refIdsTable);
         #-- now, all ids are in the refIdsTable
     END IF;
diff --git a/procedures/query/initQuery.sql b/procedures/query/initQuery.sql
index 95bdec12cc29b24e00583daa09736eb47c66d2d0..37653a36624a7995ca74eee7030b5f795ad8908e 100644
--- a/procedures/query/initQuery.sql
+++ b/procedures/query/initQuery.sql
@@ -32,25 +32,11 @@
 DROP PROCEDURE IF EXISTS db_2_0.initQuery;
 DELIMITER //
 
-CREATE PROCEDURE db_2_0.initQuery()
+CREATE PROCEDURE db_2_0.initQuery(in versioned BOOLEAN)
 BEGIN
     CREATE TEMPORARY TABLE IF NOT EXISTS warnings (warning TEXT NOT NULL);
 
-    call createTmpTable(@resultSet);
-    SELECT @resultSet as tablename;
-
-END;
-//
-DELIMITER ;
-
-DROP PROCEDURE IF EXISTS db_2_0.initVersionedQuery;
-DELIMITER //
-
-CREATE PROCEDURE db_2_0.initVersionedQuery()
-BEGIN
-    CREATE TEMPORARY TABLE IF NOT EXISTS warnings (warning TEXT NOT NULL);
-
-    call createVersionedTmpTable(@resultSet);
+    call createTmpTable(@resultSet, versioned);
     SELECT @resultSet as tablename;
 
 END;