Sort export lines before re-writing them.

/cc @puzza007 ;)