fix broken sorting