diff --git a/configure.ac b/configure.ac
index cf5d68adf42f99fe726932e9980bdc8e73040349..ba330b2f8551b68a8cb431cdfe13f8a5efc1d947 100644
--- a/configure.ac
+++ b/configure.ac
@@ -135,10 +135,15 @@ case $FC in
     PPFLAGS=$PPFLAGS" "$PP"GNU"
     FCFLAGS=" "
     AR="ar"
-    if $debug ;then
-      OPTFLAGS="-O3 -O4 -O5 -ffast-math -fallow-argument-mismatch "
+     if $debug ;then
+      OPTFLAGS="-O3 -O4 -O5 -ffast-math "
     else
-      OPTFLAGS="-O2 -g3 -fallow-argument-mismatch "
+      OPTFLAGS="-O2 -g3 "
+    fi
+    gfortranversion=$(gfortran -dumpversion)
+    gfortran10=$(echo "${gfortranversion%%.*}")
+    if test $gfortran10 -ge 10 ;then
+      OPTFLAGS=$OPTFLAGS" -fallow-argument-mismatch "
     fi
     EXEADD=".gfortran"$EXEADD
     DISLINSUB="gf"
diff --git a/scripts/compile_mps b/scripts/compile_mps
index 148a16ca55a6f44fbd95485ed4c22c9d171bb9a2..3aec5fa8cd71ef9900121e70df7ef8e25904f6a4 100755
--- a/scripts/compile_mps
+++ b/scripts/compile_mps
@@ -11,10 +11,6 @@ cfitsio=/opt/local/cfitsio/cfitsio-3.350
 dislin=/opt/local/dislin
 motif=/usr/lib64
 
-#create ifort MPI version
-./configure --with-mpi --with-cfitsio=$cfitsio
-make clean all install
-
 #create ifort version with X11
 ./configure FC=ifort --with-dislin=$dislin --with-cfitsio=$cfitsio --with-openmotif=$motif
 make clean all install
@@ -30,5 +26,11 @@ make clean all install
 #create gfortran MPI version
 module unload intel openmpi_intel
 module load openmpi_gcc
-./configure --with-mpi --with-cfitsio=$cfitsio
+./configure FC=gfortran --with-mpi --with-cfitsio=$cfitsio
+make clean all install
+
+#create ifort MPI version
+module unload openmpi_gcc
+module load intel openmpi_intel
+./configure FC=ifort --with-mpi --with-cfitsio=$cfitsio
 make clean all install