Perhaps you could provide a utility that would sort the file externally. That way you don't have to patch all the versions of BIAB that have the bug. A command line program that runs in Terminal would be fine - navigate to the correct directory and run the fix.