added copyArray