prevent circular trees