Tweak cache code. Fix tests.