Improved reference handling.