when `val` was found, we continue looping, which is actually bad, since the count will continue increasing, thus causing errors.