fix core dump error, should join the thread at the destructor