diff --git a/src/main/java/caosdb/server/database/DatabaseUtils.java b/src/main/java/caosdb/server/database/DatabaseUtils.java
index 29b8c04c420f7a09c52ad5c541a0cab9fbd9cfb6..3c48b9c86b0be5e5e3c625e382be2e9c56735c7e 100644
--- a/src/main/java/caosdb/server/database/DatabaseUtils.java
+++ b/src/main/java/caosdb/server/database/DatabaseUtils.java
@@ -217,12 +217,9 @@ public class DatabaseUtils {
     ret.datatype = bytes2UTF8(rs.getBytes("Datatype"));
     ret.collection = bytes2UTF8(rs.getBytes("Collection"));
 
-    final String path = bytes2UTF8(rs.getBytes("FilePath"));
-    if (!rs.wasNull()) {
-      ret.filePath = path;
-      ret.fileSize = rs.getLong("FileSize");
-      ret.fileHash = bytes2UTF8(rs.getBytes("FileHash"));
-    }
+    ret.filePath = bytes2UTF8(rs.getBytes("FilePath"));
+    ret.fileSize = rs.getLong("FileSize");
+    ret.fileHash = bytes2UTF8(rs.getBytes("FileHash"));
 
     ret.version = bytes2UTF8(rs.getBytes("Version"));
     ret.versionSeconds = rs.getLong("VersionSeconds");
diff --git a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLUpdateSparseEntity.java b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLUpdateSparseEntity.java
index 5daa0cea2761d4a40f1bcc03fedf4cd76ed4a401..5007047843cf734c6b94d39fb256671645e8eb80 100644
--- a/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLUpdateSparseEntity.java
+++ b/src/main/java/caosdb/server/database/backend/implementation/MySQL/MySQLUpdateSparseEntity.java
@@ -41,14 +41,30 @@ public class MySQLUpdateSparseEntity extends MySQLTransaction implements UpdateS
   }
 
   public static final String STMT_UPDATE_ENTITY = "call updateEntity(?,?,?,?,?,?,?)";
-  public static final String STMT_UPDATE_FILE_PROPS =
-      "INSERT INTO files (hash, size, path, file_id) VALUES (unhex(?),?,?,?) ON DUPLICATE KEY UPDATE hash=unhex(?), size=?, path=?;";
+  public static final String STMT_UPDATE_FILE_PROPS = "call setFileProperties(?,?,?,?)";
 
   @Override
   public void execute(final SparseEntity spe) throws TransactionException {
     try {
-      final PreparedStatement updateEntityStmt = prepareStatement(STMT_UPDATE_ENTITY);
+      // file properties;
+      final PreparedStatement updateFilePropsStmt = prepareStatement(STMT_UPDATE_FILE_PROPS);
+      updateFilePropsStmt.setInt(1, spe.id);
+      if (spe.filePath != null) {
+        updateFilePropsStmt.setString(2, spe.filePath);
+        updateFilePropsStmt.setLong(3, spe.fileSize);
+        if (spe.fileHash != null) {
+          updateFilePropsStmt.setString(4, spe.fileHash);
+        } else {
+          updateFilePropsStmt.setNull(4, Types.VARCHAR);
+        }
+      } else {
+        updateFilePropsStmt.setNull(2, Types.VARCHAR);
+        updateFilePropsStmt.setNull(3, Types.BIGINT);
+        updateFilePropsStmt.setNull(4, Types.VARCHAR);
+      }
+      updateFilePropsStmt.execute();
 
+      final PreparedStatement updateEntityStmt = prepareStatement(STMT_UPDATE_ENTITY);
       // very sparse entity
       updateEntityStmt.setInt(1, spe.id);
       updateEntityStmt.setString(2, spe.name);
@@ -67,26 +83,6 @@ public class MySQLUpdateSparseEntity extends MySQLTransaction implements UpdateS
         spe.version = DatabaseUtils.bytes2UTF8(rs.getBytes("Version"));
       }
 
-      // file properties;
-      if (spe.filePath != null) {
-        final PreparedStatement updateFilePropsStmt = prepareStatement(STMT_UPDATE_FILE_PROPS);
-        if (spe.fileHash != null) {
-          updateFilePropsStmt.setString(1, spe.fileHash);
-          updateFilePropsStmt.setString(5, spe.fileHash);
-        } else {
-          updateFilePropsStmt.setNull(1, Types.VARCHAR);
-          updateFilePropsStmt.setNull(5, Types.VARCHAR);
-        }
-        updateFilePropsStmt.setLong(2, spe.fileSize);
-        updateFilePropsStmt.setLong(6, spe.fileSize);
-
-        updateFilePropsStmt.setString(3, spe.filePath);
-        updateFilePropsStmt.setString(7, spe.filePath);
-
-        updateFilePropsStmt.setInt(4, spe.id);
-
-        updateFilePropsStmt.execute();
-      }
     } catch (final SQLIntegrityConstraintViolationException e) {
       throw new IntegrityException(e);
     } catch (final SQLException e) {