diff --git a/patches/patch.sh b/patches/patch.sh
index c9fd29374abf1b442e77121b1982f08115d38427..775bd6d5d36208a5945f2c60a2b34e99d43ffe13 100755
--- a/patches/patch.sh
+++ b/patches/patch.sh
@@ -259,7 +259,7 @@ case "$action" in
     fi
 
     echo ""
-    if grep -q $PLUMED_ROOT/src/config/compile_options.sh "-D__PLUMED_MPI=1"; then
+    if grep -q "D__PLUMED_MPI=1" $PLUMED_ROOT/src/config/compile_options.sh ; then
       echo "PLUMED is compiled with MPI support so you can configure $engine with MPI" 
     else
       echo "PLUMED is compiled WITHOUT MPI support so you CANNOT configure $engine with MPI"