fix off-by-one error introduced in bd7d7a2061