On a mail file that is set wrong look at the profile doc using notespeek or a lotusscript agent and copy down the values. The set the sort order thru the ui and look again at the profile doc and see what changed. My guess is that you missed a field in your script lib. You realize that rather then changing the script lib you can write an agent to scan and change all the mail file profile doc.
Barry