fix :begin off-by-one error