implement copy function, test