Fix taking long time on non unix systems. Fix arithmetic error in summing all thread results.