added correct bfgs/kkt update and termination condition