Add failing test
Fix off-by-one error