Trying to fix the problems cause by marionette session ending bug.