fix off-by-one mistake