Bug fixes to casgm module