fixed cache bugs