fix output format and sort order