diff --git a/rna-seq.nf b/rna-seq.nf
index 5b1536731ff53a25188fa583474359710770cabb..693199ef15b589d30e8c1730afc72bef4385b259 100644
--- a/rna-seq.nf
+++ b/rna-seq.nf
@@ -257,12 +257,6 @@ process getData {
     hostname > ${repRID}.getData.log
     ulimit -a >> ${repRID}.getData.log
 
-    # link deriva cookie for authentication
-    #echo -e "LOG: linking deriva cookie" >> ${repRID}.getData.log
-    #mkdir -p ~/.bdbag
-    #cp `readlink -e cookies.txt` ~/.bdbag/deriva-cookies.txt
-    #echo -e "LOG: linked" >> ${repRID}.getData.log
-
     # get bag basename
     replicate=\$(basename "${inputBag}")
     echo -e "LOG: bag replicate name \${replicate}" >> ${repRID}.getData.log
@@ -274,10 +268,9 @@ process getData {
 
     # bag fetch fastq's only and rename by repRID
     echo -e "LOG: fetching replicate bdbag" >> ${repRID}.getData.log
-    sh ${script_bdbagFetch} \${replicate::-13} ${repRID}
+    fastqCount=\$(sh ${script_bdbagFetch} \${replicate::-13} ${repRID})
     echo -e "LOG: fetched" >> ${repRID}.getData.log
-    
-    fastqCount=\$(find . -name '*.fastq.gz' | wc -l)
+
     if [ "\${fastqCount}" == "0" ]
     then
       touch dummy.R1.fastq.gz
diff --git a/workflow/scripts/bdbag_fetch.sh b/workflow/scripts/bdbag_fetch.sh
index 59e113647de75340ba7573a9e0db324bc89e8597..d336829125c030563c96aaf6c354b2f00bdb5a47 100644
--- a/workflow/scripts/bdbag_fetch.sh
+++ b/workflow/scripts/bdbag_fetch.sh
@@ -18,8 +18,10 @@ if [ "${validate}" != "is valid" ]
 then
     exit 1
 fi
+count=$(find */ -name "*[_.]R[1-2].fastq.gz" | wc -l)
 for i in $(find */ -name "*[_.]R[1-2].fastq.gz")
 do
     path=${2}.$(echo ${i##*/} | grep -o "R[1,2].fastq.gz")
     cp ${i} ./${path}
 done
+echo ${count}