Fixed reading messages from stream. Fixed sending messages back and forth from the server.