Fixed infinite recursion with set