diff --git a/src/nf_modules/Bowtie2/bowtie2.nf b/src/nf_modules/Bowtie2/bowtie2.nf
index 30b75312ceba63ba5df43fb2c17e7d2a73102e2a..e5cd169c496684b8c73b120e92ba150bd5810905 100644
--- a/src/nf_modules/Bowtie2/bowtie2.nf
+++ b/src/nf_modules/Bowtie2/bowtie2.nf
@@ -57,25 +57,31 @@ Channel
   .set { index_files }
 
 process mapping_fastq {
-  tag "$pair_id"
+  tag "$reads.baseName"
   cpus 4
   publishDir "results/mapping/bams/", mode: 'copy'
 
   input:
-  set pair_id, file(reads) from fastq_files
+  file reads from fastq_files
   file index from index_files.toList()
 
   output:
-  set pair_id, "*.bam" into bam_files
+  file "*.bam" into bam_files
 
   script:
+  index_id = index[0]
+  for (index_file in index) {
+    if (index_file =~ /.*\.1\.bt2/) {
+        index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1]
+    }
+  }
 """
- bowtie2 --very-sensitive -p ${task.cpus} -x ${index[0].baseName} \
- -1 ${reads[0]} -2 ${reads[1]} 2> \
- ${pair_id}_bowtie2_report.txt | \
- samtools view -Sb - > ${pair_id}.bam
+bowtie2 --very_sensitive -p ${task.cpus} -x ${index_id} \
+-U ${reads} 2> \
+${reads.baseName}_bowtie2_report.txt | \
+samtools view -Sb - > ${reads.baseName}.bam
 
-if grep -q "Error" ${pair_id}_bowtie2_report.txt; then
+if grep -q "Error" ${reads.baseName}_bowtie2_report.txt; then
   exit 1
 fi
 """
diff --git a/src/nf_modules/Bowtie2/tests/mapping_paired.nf b/src/nf_modules/Bowtie2/tests/mapping_paired.nf
index 835d0ca3c96e5f68c1650aeadff280eced9d5a11..0a1656557849d696ffc222b35a1d6cc00ad1e4c8 100644
--- a/src/nf_modules/Bowtie2/tests/mapping_paired.nf
+++ b/src/nf_modules/Bowtie2/tests/mapping_paired.nf
@@ -26,11 +26,17 @@ process mapping_fastq {
   set pair_id, "*.bam" into bam_files
 
   script:
+  index_id = index[0]
+  for (index_file in index) {
+    if (index_file =~ /.*\.1\.bt2/) {
+        index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1]
+    }
+  }
 """
- bowtie2 --very-sensitive -p ${task.cpus} -x ${index[0].baseName} \
- -1 ${reads[0]} -2 ${reads[1]} 2> \
- ${pair_id}_bowtie2_report.txt | \
- samtools view -Sb - > ${pair_id}.bam
+bowtie2 --very-sensitive -p ${task.cpus} -x ${index_id} \
+-1 ${reads[0]} -2 ${reads[1]} 2> \
+${pair_id}_bowtie2_report.txt | \
+samtools view -Sb - > ${pair_id}.bam
 
 if grep -q "Error" ${pair_id}_bowtie2_report.txt; then
   exit 1
diff --git a/src/nf_modules/Bowtie2/tests/mapping_single.nf b/src/nf_modules/Bowtie2/tests/mapping_single.nf
index c5c7f585514c7ba97da98a660c02964a4d5a91b1..201c32cbd1cfbb754e40c074dfaf4af7dafdb094 100644
--- a/src/nf_modules/Bowtie2/tests/mapping_single.nf
+++ b/src/nf_modules/Bowtie2/tests/mapping_single.nf
@@ -25,8 +25,14 @@ process mapping_fastq {
   file "*.bam" into bam_files
 
   script:
+  index_id = index[0]
+  for (index_file in index) {
+    if (index_file =~ /.*\.1\.bt2/) {
+        index_id = ( index_file =~ /(.*)\.1\.bt2/)[0][1]
+    }
+  }
 """
-bowtie2 --very_sensitive -p ${task.cpus} -x ${index[0].baseName} \
+bowtie2 --very_sensitive -p ${task.cpus} -x ${index_id} \
 -U ${reads} 2> \
 ${reads.baseName}_bowtie2_report.txt | \
 samtools view -Sb - > ${reads.baseName}.bam