diff --git a/preproc_fastq/trimgalore.sh b/preproc_fastq/trimgalore.sh
index 5cf4f8306fa314696391d65d857c299edfe649bf..e198d3c950a41584a0a62e0ea18831d418fd1c0c 100644
--- a/preproc_fastq/trimgalore.sh
+++ b/preproc_fastq/trimgalore.sh
@@ -30,7 +30,7 @@ if [[ -z $pair_id ]]; then
 fi
 fqs=''
 i=0
-numfq=$#
+numfq=${#fqs[@]}
 while [[ $i -le $numfq ]]
 do
     fqs="$fqs $1"
@@ -51,14 +51,13 @@ fi
 
 numfq=${#fqs[@]}
 copts='-q 25 --illumina --gzip --length 35'
-if [[ $numfq == 2 ]]
+if [[ $numfq == 1 ]]
 then
     copts="$copts --paired"
 fi
     
 source /etc/profile.d/modules.sh
 module load trimgalore/0.6.4 cutadapt/2.5
-
 trim_galore $copts ${fqs}
 files=`find ./ -name "*_val_1.fq.gz"`