Improve out-of-range handling