fixed broken sorting