clean up shared_ptr usage