Cache fixes and more tests.