Fixed some bugs in the client-server interaction.