fixed typos in sanity check
sort by record type and priority