[UPDATE] only copy array when sorting is required.