add sorted array, fixed #3