improved __eq__ and __ne__ functions