Removing invalid text references