fix a bug when getting number of cores