Fix bugs in the CM chaos metric