diff --git a/public/bam2wig/src/main/scala/nl/lumc/sasc/biopet/pipelines/bamtobigwig/Bam2Wig.scala b/public/bam2wig/src/main/scala/nl/lumc/sasc/biopet/pipelines/bamtobigwig/Bam2Wig.scala
index e76acd863a3eed3ebdcb1a4b1b5654fe71d623b9..8c1f543bf551d7b828bf17ea4afda47c1bf036dd 100644
--- a/public/bam2wig/src/main/scala/nl/lumc/sasc/biopet/pipelines/bamtobigwig/Bam2Wig.scala
+++ b/public/bam2wig/src/main/scala/nl/lumc/sasc/biopet/pipelines/bamtobigwig/Bam2Wig.scala
@@ -46,7 +46,7 @@ class Bam2Wig(val root: Configurable) extends QScript with BiopetQScript {
 object Bam2Wig extends PipelineCommand {
   def apply(root: Configurable, bamFile: File): Bam2Wig = {
     val bamToBigWig = new Bam2Wig(root)
-    bamToBigWig.outputDir = bamFile.getParent
+    bamToBigWig.outputDir = bamFile.getParentFile
     bamToBigWig.bamFile = bamFile
     bamToBigWig.init()
     bamToBigWig.biopetScript()
diff --git a/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala b/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala
index 8dbf2f035b637e21885468b074ebca8c2d960d89..e6e483ab4b24cf2146c23946d12932f41021b269 100644
--- a/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala
+++ b/public/mapping/src/main/scala/nl/lumc/sasc/biopet/pipelines/mapping/Mapping.scala
@@ -186,7 +186,7 @@ class Mapping(val root: Configurable) extends QScript with BiopetQScript {
         fastq_R2_output :+= R2
       }
 
-      val outputBam = new File(chunkDir + outputName + ".bam")
+      val outputBam = new File(chunkDir, outputName + ".bam")
       bamFiles :+= outputBam
       aligner match {
         case "bwa"        => addBwaMem(R1, R2, outputBam, deps)
@@ -198,7 +198,7 @@ class Mapping(val root: Configurable) extends QScript with BiopetQScript {
         case _            => throw new IllegalStateException("Option Aligner: '" + aligner + "' is not valid")
       }
       if (config("chunk_metrics", default = false))
-        addAll(BamMetrics(this, outputBam, chunkDir + "metrics/").functions)
+        addAll(BamMetrics(this, outputBam, new File(chunkDir, "metrics")).functions)
     }
     if (!skipFlexiprep) {
       flexiprep.runFinalize(fastq_R1_output, fastq_R2_output)