fix error counter problem