More tweaks to session logic.