added special case for threadNo == 1