fixing the equality comparison to detect different type IDs and properly define __ne__