compareTo may fail with NullPointerException