fix bugs for websocket