remote: make copy_ref() perform a deep copy