fixes copy function