Clear internal caches when switching active configurations

Close #851.
Merge pull request #900 from dungpa/cache-handling

Clear internal caches when switching active configurations