fix pthread error, diff pointers in diff thread