pthread fixes