fix sort not works when max count reached