fix an off-by-one error