diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf
index 23d59c8284a191c68f354a39c68d52261003715b..abec0190f6901d66f0f84be07a3f4eff51b8992e 100644
--- a/workflow/rna-seq.nf
+++ b/workflow/rna-seq.nf
@@ -757,13 +757,13 @@ process alignSampleData {
 
     # convert the output sam file to a sorted bam file using Samtools
     echo -e "LOG: converting from sam to bam" >> ${repRID}.${ref}.alignSampleData.log
-    samtools view -1 -@ `nproc` -m \${mem}K -F 4 -F 8 -F 256 -o ${ref}.sampled.bam ${ref}.sampled.sam
+    samtools view -1 -@ `nproc` -F 4 -F 8 -F 256 -o ${ref}.sampled.bam ${ref}.sampled.sam
 
     # sort the bam file using Samtools
     echo -e "LOG: sorting the bam file" >> ${repRID}.${ref}.alignSampleData.log
     mem=\$(vmstat -s -S K | grep 'total memory' | grep -o '[0-9]*')
     mem=\$(expr \${mem} / `nproc` \\* 85 / 100)
-    samtools sort -@ `nproc` -O BAM -o ${ref}.sampled.sorted.bam ${ref}.sampled.bam
+    samtools sort -@ `nproc` -m \${mem}K -O BAM -o ${ref}.sampled.sorted.bam ${ref}.sampled.bam
 
     # index the sorted bam using Samtools
     echo -e "LOG: indexing sorted bam file" >> ${repRID}.${ref}.alignSampleData.log