Fixes off-by-one error.