fix cache usage, and test
Merge pull request #99 from matiu/bug/fix-cache

Bug/fix cache