Fix permissions error using restricted APIs.