be careful when using the copy of shared_ptr