CG using optim may actually be working