Handle special attribute __class__ for any object and cleanup old code