pthread causes issue