Added support for cyclic references to _clone() and _isIdenticalTo() to avoid infinite loop