better support for ref and extend