bugfix, off by 1