fix concurrency in Cache.undo()