fixed bug with OnDisposed and OnSessionEnd