count error types and fix tests