Revert "Revert "Prevent the folder cache from being overwritten.""

This reverts commit 5f3c55b8d1ff39e25d85f21eab805e79db0dbc87.
Correctly fix Bug: 13273