make visited and safe unique