moved session listener onEnd logic into MM.Listener