Fix problem with serializing errors with complex objects.