Fix setting of number of threads in bundle adjustment