Fixed the variable scope of processedNames