removes references to nonexistent images