diff --git a/process/config.py b/process/config.py
index e4dc7b076486bba8a71435804bd90a9c6046059a..775ef01da1074a2b678f22fbb99df4b412ef84b9 100644
--- a/process/config.py
+++ b/process/config.py
@@ -438,6 +438,8 @@ DONT_DELETE = [
 
 # function to clean up temporary files if they are not in the DONT_DELETE list
 def cleanup(dataset):
+    if isinstance(dataset, str):
+        dataset = Path(dataset)
     if dataset not in DONT_DELETE:
         if dataset.is_file():
             dataset.unlink()