fix sorting bug and remove log output