session: fix terminal management