Sort order bugfix