~ bugfix & refactorings of cache-mgr.js