Fix off-by-one error
More tests