Compatibility fixes related to CMSMS 2.x and PHP 7