added attribute_cast_special and minor fixes