diff --git a/util/build_detector.sh b/util/build_detector.sh
index 2497d8800e12e200fa484a8a7661171925699844..c2b5209760bc9f3fc8e284182ce06eed632aa4ec 100755
--- a/util/build_detector.sh
+++ b/util/build_detector.sh
@@ -44,7 +44,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