fixed problems with detecting automatic number of threads