Forward port CMS root patches

This is a forward port of all the non threading related patches from cms/v5-34-18 to cms/v5-34-18.

@Dr15Jones