fixed a bug with conjugate gradient