added copy_relations function