fixed sorting of states