Correct some issues with cache overwrite