diff --git a/picard.wdl b/picard.wdl
index b78e60397da063549140fa94d42b6eece0d8538f..5a759247fe90b4e8ca09ad3ee1e262cbe22c9738 100644
--- a/picard.wdl
+++ b/picard.wdl
@@ -317,25 +317,24 @@ task CreateSequenceDictionary {
     input {
         File inputFile
         String outputDir
-        String basenameInputFile = basename(inputFile)
 
-        String memory = "2G"
+        String memory = "3G"
         String javaXmx = "2G"
         String dockerImage = "quay.io/biocontainers/picard:2.22.3--0"
     }
 
     command {
         set -e
-        mkdir -p "$(dirname ~{outputDir})"
+        mkdir -p "~{outputDir}"
         picard -Xmx~{javaXmx} \
         -XX:ParallelGCThreads=1 \
         CreateSequenceDictionary \
         REFERENCE=~{inputFile} \
-        OUTPUT="~{outputDir}/~{basenameInputFile}.dict"
+        OUTPUT="~{outputDir}/$(basename ~{inputFile}).dict"
     }
 
     output {
-        File outputDict = outputDir + "/" + basenameInputFile + ".dict"
+        File outputDict = outputDir + "/" + basename(InputFile) + ".dict"
     }
 
     runtime {
@@ -347,7 +346,6 @@ task CreateSequenceDictionary {
         # inputs
         inputFile: {description: "The input fasta file.", category: "required"}
         outputDir: {description: "Output directory path.", category: "required"}
-        basenameInputFile: {description: "The basename of the input file.", category: "required"}
         memory: {description: "The amount of memory available to the job.", category: "advanced"}
         javaXmx: {description: "The maximum memory available to the program. Should be lower than `memory` to accommodate JVM overhead.", category: "advanced"}
         dockerImage: {description: "The docker image used for this task. Changing this may result in errors which the developers may choose not to address.", category: "advanced"}
diff --git a/samtools.wdl b/samtools.wdl
index 6c523947eedfcdd572623885d8b17d1421283be6..15ea9a209863ccc3338e9f3d21f945e7675c92f8 100644
--- a/samtools.wdl
+++ b/samtools.wdl
@@ -67,13 +67,13 @@ task Faidx {
         String dockerImage = "quay.io/biocontainers/samtools:1.10--h9402c20_2"
     }
 
-    command <<<
+    command {
         set -e
-        mkdir -p "$(dirname ~{outputDir})"
+        mkdir -p "~{outputDir}"
         ln ~{inputFile} "~{outputDir}/~{basenameInputFile}"
         samtools faidx \
         "~{outputDir}/~{basenameInputFile}"
-    >>>
+    }
 
     output {
         File outputIndex = outputDir + "/" + basenameInputFile + ".fai"
@@ -179,8 +179,9 @@ task Merge {
 task Sort {
     input {
         File inputBam
-        String outputPrefix
+        String outputPath
         Boolean sortByName = false
+        Int compressionLevel = 1
 
         String memory = "2G"
         String dockerImage = "quay.io/biocontainers/samtools:1.10--h9402c20_2"
@@ -190,18 +191,17 @@ task Sort {
 
     command {
         set -e
-        mkdir -p "$(dirname ~{outputPrefix})"
+        mkdir -p "~{outputPath}"
         samtools sort \
-        "-l 1"
+        "-l " ~{compressionLevel} \
         ~{true="-n" false="" sortByName} \
-        "--output-fmt BAM" \
         ~{"--threads " + threads} \
-        -o "~{outputPrefix}.sorted.bam" \
+        "-o " ~{outputPath} \
         ~{inputBam}
     }
 
     output {
-        File outputSortedBam = outputPrefix + ".sorted.bam"
+        File outputSortedBam = outputPath
     }
 
     runtime {