fix various bugs with syncing chains, not quite there yet