Corrected cache-check logic.