Fix off-by-one

Closes issue #4