off-by-one errors are fun