Fix off-by-one error that caused unit test to fail