Modify fixed thread number to dynamic number