some fixes to allow fewer threads than cores in the pthreads case