Cache fixes and test script.