fix bug sorting bug