added ref support