solved sorting bug