check for sorting array