adjust the LBFGS API for robustness