Off-by-one error spotted by Jason McLafferty