added sychronization guards to the server too