Fixed bug in logic to determine # of heavyweight threads

and a typo