Bug fixes of the pthread specific and a test added.