use toArray instead of clone