Fixed the net code between the server and the client. Also added some error handling.