error handling for sort