fix an off-by-one issue in the output JSON