Bug fix for BFGS