modified AppDelegate