Cherry pick essential commits from 4.stable

I have cherrypicked (3 out 4) commits that are lying around in `4.stable` branch. 

Put up PR for the verifications by @npostavs and others Since I had to fiddle around by hand as the merge was mess.

fixes #1450