Added handling for nonexistent apps in the database