Improve getErrors() and fix tests.