fix of-by-one