This is similar to the fix in the previous commit and is needed for the same reason. (cherry picked from commit fab541a8ff8e62914c6dee905558ec3270d51432)