Simplify the shared_ptr checks.