added OnAppShutdown hook