Fix crash caused by calling destructor twice, improve sync_dhs friend
syncing