Reintroduce a fix that was lost when the SDK was downgraded back to 5.2
(cherry picked from commit 3d789002)