set number of threads
handle missing thread count