Last problem wasn't off by one; was logic error