Fix qualified ref_cast call