fix test
fix off-by-one error