modify thread starting algorithm.