fixed bugs in client to server sync