Fix websocket variable access from listeners