diff --git a/fastqc.wdl b/fastqc.wdl
index f1d23885f210e73b2452be62b499ca6ab553ed85..3a3b1110f6836104e9960a019ec241bac056326e 100644
--- a/fastqc.wdl
+++ b/fastqc.wdl
@@ -21,10 +21,10 @@ task Fastqc {
     }
 
     # Chops of the .gz extension if present.
-    String name = sub(seqFile, "\.gz$","")
+    String name = basename(sub(seqFile, "\.gz$","")) # The Basename needs to be taken here. Otherwise paths might differ between similar jobs.
     # This regex chops of the extension and replaces it with _fastqc for the reportdir.
     # Just as fastqc does it.
-    String reportDir = outdirPath + "/" + sub(basename(name), "\.[^\.]*$", "_fastqc")
+    String reportDir = outdirPath + "/" + sub(name, "\.[^\.]*$", "_fastqc")
 
     command {
         set -e -o pipefail