dupe ref and recursion detection for arrays