fix building the cache when cache cannot been written and does not exist
old changes...