BUG: add explicit clean up of the cachemanager at exit of programs, so dll destruction is not a problem.