diff --git a/common/cpp/src/system_io/system_io.cpp b/common/cpp/src/system_io/system_io.cpp
index f8dc19c3148cdb603fa584dd4d41e5bd62ae8266..630685b381299c54e99fe4ac2fc776ced2ba9e1e 100644
--- a/common/cpp/src/system_io/system_io.cpp
+++ b/common/cpp/src/system_io/system_io.cpp
@@ -124,7 +124,7 @@ void asapo::SystemIO::CreateNewDirectory(const std::string& directory_name, Erro
 
 Error SystemIO::WriteDataToFile(const std::string& fname, const uint8_t* data, size_t length) const {
     Error err;
-    auto fd = Open(fname, IO_OPEN_MODE_CREATE_AND_FAIL_IF_EXISTS | IO_OPEN_MODE_RW, &err);
+    auto fd = Open(fname, IO_OPEN_MODE_CREATE | IO_OPEN_MODE_RW, &err);
     if (err) {
         return err;
     }
diff --git a/tests/automatic/producer_receiver/check_mongo_restart/check_linux.sh b/tests/automatic/producer_receiver/check_mongo_restart/check_linux.sh
index 6a60eeed60d480a7312cfd00c63bf8250a3fb10f..e7a5dc5e57a84e402d2e62ca07c0847c3c066c48 100644
--- a/tests/automatic/producer_receiver/check_mongo_restart/check_linux.sh
+++ b/tests/automatic/producer_receiver/check_mongo_restart/check_linux.sh
@@ -32,8 +32,13 @@ database_name=db_test
 beamtime_id=asapo_test
 beamline=test
 
+receiver_root_folder=/tmp/asapo/receiver/files
+receiver_folder=${receiver_root_folder}/${beamline}/${beamtime_id}
+
+
 Cleanup() {
 	echo cleanup
+	rm -rf ${receiver_root_folder}
     nomad stop receiver
     nomad stop discovery
     nomad stop authorizer
@@ -50,7 +55,7 @@ wait_mongo
 echo "db.${beamtime_id}.insert({dummy:1})" | mongo --port 27016 ${beamtime_id}
 
 sed -i 's/27017/27016/g' receiver.json.tpl
-sed -i 's/"WriteToDisk":true/"WriteToDisk":false/g' receiver.json.tpl
+#sed -i 's/"WriteToDisk":true/"WriteToDisk":false/g' receiver.json.tpl
 
 
 nomad run authorizer.nmd
@@ -58,6 +63,9 @@ nomad run nginx.nmd
 nomad run receiver.nmd
 nomad run discovery.nmd
 
+mkdir -p ${receiver_folder}
+
+
 sleep 1
 
 nfiles=1000
diff --git a/tests/automatic/system_io/write_data_to_file/CMakeLists.txt b/tests/automatic/system_io/write_data_to_file/CMakeLists.txt
index fd034a4d2385b6b8069962b68ffc0485dd16afaa..8a576706d71ad65f73eeb8257400307c4f1bdf43 100644
--- a/tests/automatic/system_io/write_data_to_file/CMakeLists.txt
+++ b/tests/automatic/system_io/write_data_to_file/CMakeLists.txt
@@ -15,6 +15,6 @@ set_target_properties(${TARGET_NAME} PROPERTIES LINKER_LANGUAGE CXX)
 ################################
 add_test_setup_cleanup(${TARGET_NAME})
 add_integration_test(${TARGET_NAME} writeok "test_file ok dummy" nomem)
-add_integration_test(${TARGET_NAME} writetwice "test_file error kFileAlreadyExists:test" nomem)
+add_integration_test(${TARGET_NAME} writetwice "test_file ok dummy" nomem)
 add_integration_test(${TARGET_NAME} dirnoaccess "test_noaccess/test_file error Permissiondenied:test_noaccess/test_file" nomem)