Fixes to pie's sort function


git-svn-id: http://chianti.ucsd.edu/svn@31197 0ecc0d97-ab19-0410-9704-bfe1a75892f5