Added check for rule structure cycles