fix trainglepart sort routines