fixed cache logic! finally