Count offset bug fix