Fixes race condition with restoring cache to master branch after copy