trying to fix ref bugs in modify_copy