corrected minor sorting bug