Two sorting fixes