critical bug fix off by one