fixes sorting with NaN & infinite values