Fix off-by-one error.

Resulted in incorrect results: the last unknown code wouldn't be considered.