Added protection against recursive objects.