fix exception on session restore