Sync with stable.
Fix for edge case when incorrect permissions were set in the custom platform.