Correct sorting order for stages