Fixes for unit tests, caching