diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b5614ecfcfbd748cc4b22145bcfe03c5ff615d35..a7a54aa6a889e1743742fa76fdd385d93a24f7ea 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -1,10 +1,12 @@
 before_script:
   - export LANG=C
-  - module load impi/5.1.3 intel/16.0 gcc/4.9 mkl/11.3 autotools pkg-config 2>&1 | grep "ERROR" && exit 1 || true
+  - errorlog=$(mktemp)
+  - module load impi/5.1.3 intel/16.0 gcc/4.9 mkl/11.3 autotools pkg-config 2>$errorlog
+  - if grep "ERROR" $errorlog ; then rm $errorlog; exit 1; else rm $errorlog; fi
   - module list
   - export LD_LIBRARY_PATH=$MKL_HOME/lib/intel64:$LD_LIBRARY_PATH
   - export PATH=/home/elpa/python-3.6/bin:$PATH
-  - env
+  - env | sort
 
 # define two stages, that way coverage only runs after all other
 # tests have been done.