Add function that count errors.