fix an off-by-one error (fixes #6)