diff --git a/public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala b/public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
index f16db9b0e39edbbc243ac7c5ce54bbd83defd857..5a17ea0d95d43b2ba57d456821f89a60d5135c6a 100644
--- a/public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
+++ b/public/bammetrics/src/main/scala/nl/lumc/sasc/biopet/pipelines/bammetrics/BamMetrics.scala
@@ -69,12 +69,12 @@ class BamMetrics(val root: Configurable) extends QScript with BiopetQScript {
 
       val strictOutputBam = new File(targetDir, inputBam.getName.stripSuffix(".bam") + ".overlap.strict.bam")
       add(BedtoolsIntersect(this, inputBam, bedFile, strictOutputBam, minOverlap = config("strictintersectoverlap", default = 1.0)), true)
-      add(SamtoolsFlagstat(this, strictOutputBam))
+      add(SamtoolsFlagstat(this, strictOutputBam, targetDir))
       add(BiopetFlagstat(this, strictOutputBam, targetDir))
 
       val looseOutputBam = new File(targetDir, inputBam.getName.stripSuffix(".bam") + ".overlap.loose.bam")
       add(BedtoolsIntersect(this, inputBam, bedFile, looseOutputBam, minOverlap = config("looseintersectoverlap", default = 0.01)), true)
-      add(SamtoolsFlagstat(this, looseOutputBam))
+      add(SamtoolsFlagstat(this, looseOutputBam, targetDir))
       add(BiopetFlagstat(this, looseOutputBam, targetDir))
 
       val coverageFile = new File(targetDir, inputBam.getName.stripSuffix(".bam") + ".coverage")
diff --git a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/samtools/SamtoolsFlagstat.scala b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/samtools/SamtoolsFlagstat.scala
index e267684554ed0042061d92f2393b15f09871bbd6..a4833d5f17c509fc0a47ca77a631e2ec32596bd1 100644
--- a/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/samtools/SamtoolsFlagstat.scala
+++ b/public/biopet-framework/src/main/scala/nl/lumc/sasc/biopet/extensions/samtools/SamtoolsFlagstat.scala
@@ -33,13 +33,7 @@ object SamtoolsFlagstat {
   def apply(root: Configurable, input: File, outputDir: File): SamtoolsFlagstat = {
     val flagstat = new SamtoolsFlagstat(root)
     flagstat.input = input
-    flagstat.output = new File(outputDir + swapExtension(input.getName))
+    flagstat.output = new File(outputDir, input.getName.stripSuffix(".bam") + ".flagstat")
     flagstat
   }
-
-  def apply(root: Configurable, input: File): SamtoolsFlagstat = {
-    return apply(root, input, new File(swapExtension(input.getAbsolutePath)))
-  }
-
-  private def swapExtension(inputFile: String) = inputFile.stripSuffix(".bam") + ".flagstat"
 }
\ No newline at end of file