Change ref() to getindex()