fixing cache saving to disk