Fixed typos.
Add pthread library where required.