Fixed possible session crash