Fix/cleanup shared_ref