Merge "Avoid applying unexpected sync state when checking sync finish" into main