Fix bug in class map caching found by the unit tests.