Fix npe when opening an old session