Fixed/improved cache handling