Fixes to session mechanism.