Bugs Fixed and Authentication response change

Fixed bug where socket was closed before finished with