pthreads scheduling, some minor fixes