fix sorted() function to allow integer-based unique values