Revert "Fixed a bug in solver::cg"

This reverts commit 61e08e011370c415e8a3c7c17413adbaedfdb2e0.
The version with the 'bug' actually worked better.
Count iterations in CG more accurately