Fix race condition caused by concurrent access to global cache
"kpm restore" prints out the dependency graph after restore