Fixed std::shared_ptr multi-threading issue