ThreadUtil: make createThreads more robust