added -pthread flag