Removing invalid entries