Added connection switching to DataObject->write().