Fixing small bugs in the server connection and preparing for client.