added pthread linking