Equality function and nil values fixes