sorting fixes