fixed a bug ine the PTHREADS version of the BFGS optimization