Better error messages and tests.