Fixed compilation. toArray → copyToArray