diff --git a/util/build_detector.sh b/util/build_detector.sh
index c8ce9335b80e04573d674a0ad7c0ec00add24ec3..aab1ed0079d62f3e91bef37d6da0585353814db8 100755
--- a/util/build_detector.sh
+++ b/util/build_detector.sh
@@ -42,7 +42,7 @@ git clone -b ${JUGGLER_DETECTOR_VERSION} https://eicweb.phy.anl.gov/EIC/detector
 #fi
 ## We also need an up-to-date copy of the accelerator. For now this is done
 ## manually. Down the road we could maybe automize this with cmake
-if [ ! -d accelerator ]; then
+if [ -d accelerator ]; then
   echo "cleaning up accelerator"
   rm -rf accelerator
 fi