fix strang off-by-one