Fixed cache logic.