Fix bug for KeyError and WebSocketError(MSG_SOCKET_DEAD).