Fix code issue with cache flag