fixed numerical stability in cPhi