bug fix, off by one