Apply vanilla 3.9.6 patches
Merge branch 'master' into memlcd-embedded