small fixes to session handling