sort the solutions to be compatible with Mathematica 9