add thread limitation