diff --git a/bin/compile b/bin/compile
index babd780fd716c850e4d82dbf5f3fdf4804e45eac..da62406685b9fb9d89b48ed42c4f51d1ed8425d6 100755
--- a/bin/compile
+++ b/bin/compile
@@ -209,8 +209,8 @@ bpwatch stop post_compile
 
 # Store new artifacts in cache.
 bpwatch start dump_cache
-    rm -rf $CACHE_DIR/$dir
-    cp -R $dir $CACHE_DIR/
+    rm -rf $CACHE_DIR/$CACHED_DIR
+    cp -R $CACHED_DIR $CACHE_DIR/
 bpwatch stop dump_cache
 
 # ### Fin.