fix NPE in dates compare