some changes for better websocket support