Bugs fix for Thread