fixed copy_func to use array_insert