improve pthread support