Fixed a bug in the AppDelegate.