Removes invalid file and code references.