We already handle reference refs properly elsewhere, but needed to handle it here as well. Tested x86_64-pc-linux-gnu, applying to trunk.