Fix sync bugs