fixed error in session handling