added sorting bug