Check cyclic references when writing arrays and maps