Fixed some issues with WebSocket implementation