moved error count to logError