fixed invalid thread access error