fix session restoration upon a handshake