Fix a big bug in CG.