BUG: off by one error