fix some cache bugs