actually fix off-by-one bug this time