Apply #4441 fix to 3.9