diff --git a/src/caoscrawler/crawl.py b/src/caoscrawler/crawl.py
index d0175b38c59c1ef09c04e0bf1c069b542f50b86a..caff45847c6ec669a9da07856bed4c14122e6d9a 100644
--- a/src/caoscrawler/crawl.py
+++ b/src/caoscrawler/crawl.py
@@ -1035,7 +1035,7 @@ def _treat_deprecated_prefix(prefix, remove_prefix):
     return remove_prefix
 
 
-def _fix_file_paths(crawled_data):
+def _fix_file_paths(crawled_data, remove_prefix):
     for elem in crawled_data:
         if isinstance(elem, db.File):
             # correct the file path:
@@ -1148,7 +1148,7 @@ def crawler_main(crawled_directory_path: str,
         debug_tree = DebugTree()
         crawled_data = scan_directory(
             crawled_directory_path, cfood_file_name, restricted_path, debug_tree=debug_tree)
-        _fix_file_paths(crawled_data)
+        _fix_file_paths(crawled_data, remove_prefix)
         _check_record_types(crawled_data)
 
         if provenance_file is not None and debug: