Make ref-to-vref function fast