diff --git a/workflow/rna-seq.nf b/workflow/rna-seq.nf
index f890b82e0f0cc54b04d228e024bb8ffb42caecc3..f15deb48d43405b853754d68c25e446f9e315982 100644
--- a/workflow/rna-seq.nf
+++ b/workflow/rna-seq.nf
@@ -564,10 +564,11 @@ process fastqc {
     # run fastqc
     echo -e "LOG: running fastq on raw fastqs" >> ${repRID}.fastqc.log
     fastqcErrorOut=false
-    fastqc *.fastq.gz -o . || fastqcErrorOut=true
+    fastqc *.fastq.gz -o . &> fastqc.out || :
+    fastqcErrorOut=\$(cat fastqc.out | grep -c 'Failed to process file')
     fastqFileError=false
     fastqFileError_details=""
-    if [ "\${fastqcErrorOut}" == "true" ]
+    if [ "\${fastqcErrorOut}" -gt "0" ]
     then
       fastqFileError=true
       fastqFileError_details="**There is an error with the structure of the fastq**"