Merge "Set scan flags correctly for preloaded applications"