fixes sorting on nil