small changes to pThread