Fix AppDelegate code