minor error counting bug fix