Fixed small bug in session handling