simplified _cast and __ne__