Fix a race condition when loading the cache