scheduler bugfix and add threading config options