Some fixes for CMS scripts