Fix cache check. #559