Fix the bug in coefOptimize()

fix sd bug