fixed cache code some more