Fix issue in error count (#4960)