adding fix off-by-one issue
3.1.1