Fix tests for error cases.