Get rid of excessive null checks in equals methods