core/array: fix implementation of naive copy_to to avoid overwriting