fix sorted method