fix sorting, seems to work now