finally handle cycles properly