Fix bug where sessionId gets stuck in the "waiting" state