Fixed thread instantiation issue