Two federal agencies that put Americans at risk for identity-theft-like problems have fixed a glitch that linked U.S. Social Security numbers to those issued by three foreign countries, officials said.

The problem, which mostly affects Maine and New Hampshire, involves three Pacific Island nations that receive disaster loans, grants and other aid from the United States in exchange for military privileges in the region.

The U.S. Department of Agriculture, one of the agencies that issues the aid, has replaced all the Social Security numbers of affected borrowers in its loan processing system with new characters that don't match any U.S. numbers, an agency spokesman told The Associated Press, which first reported the problem in August.

The Federated States of Micronesia, the Republic of the Marshall Islands and the Republic of Palau all have their own Social Security systems, but the USDA and several other agencies have treated numbers issued by the three nations as if they were U.S. numbers, regardless of whether they were already in use.

That can create headaches similar to identity theft when identities become linked in the eyes of lenders or creditors. In one case, when a Micronesian man defaulted on a $7,306 loan from the U.S. Small Business Administration, collection agencies sought out a New Hampshire woman with a matching Social Security number.

Though the USDA has known for years that numbers were getting mixed up, it made no changes to its software or procedures until recently.

The Small Business Administration also has taken steps to protect Americans whose numbers may match aid recipients from the three nations and will consider writing letters to credit bureaus on behalf of those who have been affected, a spokeswoman said Monday.

"The SBA has put in place a review process that will protect individuals with unusual Social Security numbers from being incorrectly penalized by the credit bureaus," said spokeswoman Carol Chastang.

The new process will also flag potential matches going forward, she said. At the Agriculture Department, it was unclear whether the fix would affect only current files or whether the agency also has changed how it will handle Social Security numbers of future aid recipients.

The Department of Education explicitly tells aid applicants from the three nations to skip the section of the application that requires a Social Security number.

There's no way to tell how many Social Security numbers other agencies have mixed up. But the USDA, SBA and the Federal Emergency Management Agency have given grants and loans to more than 13,000 people in the three island nations since 2000.

FEMA, however, no longer offers direct financial aid in the region, and the agency that took over its disaster aid duties doesn't collect Social Security numbers from grant applicants.