fixing the socket re-creation