Fixed several long-standing sync bugs