A few minor sorting fixes