portable way to unwrap the session (#266)