fix linking to pthread for Ubuntu