More bug fixes for state changes in AppDelegate