added counter to get_untitled_name to guarantee new name uniqueness