Merging the relevant fixes from 2.3.6 patch.