addedadj deriv computation to optimization, but it doesn't work