Make type optional in countErrors