Several small fixes to syncing system