Apply vanilla 3.9.6 patches
Merge branch 'master' into test