diff --git a/build_lofar_cepH.sh b/build_lofar_cepH.sh
index 968983d1988ac3cc971a515125c6bb43d3128852..c812e17657dabf6cdbf35ca13d89562c8099621d 100644
--- a/build_lofar_cepH.sh
+++ b/build_lofar_cepH.sh
@@ -416,7 +416,7 @@ if [ ! -e $prefix/.done ]; then
     touch $prefix/.done
 else
     echo DP3 already installed.
-fi
+fi || exit 1
 
 prefix=$INSTALLDIR/wsclean
 if [ ! -e $prefix/.done ]; then
@@ -460,7 +460,7 @@ if [ ! -e $prefix/.done ]; then
     touch $prefix/.done
 else
     echo WSClean already installed.
-fi
+fi || exit 1 
 
 prefix=$INSTALLDIR/pyBDSF &&
 pybdsflib=$prefix/lib/python$PYTHON_VERSION/site-packages