fix out-of-range during a check