diff --git a/wGRR b/wGRR
index bdcdaf71f325b94750ef404e7736ff667c0d17fe..73a2ce71a33a0774ebe1726b84fd59e5def777c3 100755
--- a/wGRR
+++ b/wGRR
@@ -348,8 +348,8 @@ if [[ ! -f "$OUT".wgrr.txt ]] ; then
 fi
 
 NLINES=$(wc -l "$OUT".wgrr.txt | awk '{print $1}')
-NWGRR=$((STATS[1]*2+1))
-if [[ $NLINES -le $NWGRR ]] ; then
+NWGRR=$((STATS[1]*STATS[1]+1))
+if [[ $NLINES -lt $NWGRR ]] ; then
 	echo "[ERROR]     --  An error occurred during wGRR calculation:"
 	echo "[ERROR]     --  less lines than expected in the final file."
 	echo "[ERROR]     --  Saving the partial files in ${OUT}.wgrr_part directory."