Fixing issue with onSessionEnd events firing