fix #5 (off-by-one error)