sorting bugfix