Fixed thread access bug