cross platform threading fixing