Fix std::system error by checking join status, fix Read memory leak