fix NPE in equal function