Fix bugs related to creating orphan records on receiving side.