tests for cache

+ bugfixes on cache