improve sorted fetch: max -> n
fix sort when removing from top
fix sort when removing from top