Fix linking issue with threads library.