Fixed bug in ThreadTest