stronger out-of-bounds fix with integral reset