Fix a bug to create the appdata dir if it doesn't exist