correct range check