Fix incorrect caching behaviour