Fix bugs in CMS detector