thread fix for Mac