support two sort modes