More than 1000 people receiving money from government to help with their housing costs have been underpaid by $1.4 million.
The mistake happened because the Ministry of Social Development's (MSD) accommodation supplement area boundaries weren't always properly updated.
It has meant some people weren't paid the correct amount they were entitled to, and documents obtained by RNZ under the Official Information Act show they are owed, on average, $1190 each.
The accommodation supplement is a weekly payment that helps people with their rent, board or other housing costs.
How much people get depends not just on what they earn, but also where they live - meaning areas with higher housing costs will attract a higher amount.
But between 2001 and 2018, the MSD said the area boundaries weren't being set according to legal requirements.
That issue was fixed with a law change in 2017, that came into effect on 1 April 2018.
Of the 1162 people owed money, half of them are still MSD clients.
There were 11 people who were owed more than $10,000 because of the error. Another 44 were owed between $5000 and $10,000.
But that is not the only problem MSD has been rushing to fix.
It also discovered that it hadn't been giving people enough notice before reducing or stopping their benefit, if they had an outstanding warrant to arrest.
MSD is required to give clients 10 working days' notice before doing this.
But between July 2013 and June 2016, it wasn't allowing four calendar days after the letter had been posted for it to be received.
The 10 working days' notice should have started four days after the letter was sent but MSD was suspending or reducing benefits four days early.
That has left 2522 people out of pocket by $260,000 in total. Of them, 1589 are still MSD clients.
The average amount owed was $103 each. The maximum amount owed to any one client was $860 and the minimum owed was less than $1.
Just over 1000 people were owed between $100 and $500.
The error was fixed in August 2016 and MSD's payment system now automatically includes time to allow for the letter to be received.
Back-payments have been made to affected people from June last year.
Ministry of Social Development group general manager client experience and design Matt McLay said everyone the ministry had contact details for had been repaid.
That means 645 people affected by the accommodation supplement issue have got their money back and 1930 people affected by the warrant to arrest problem have been repaid.
McLay said those people who were still owed money were former clients that it didn't have current details for.
Each week, the ministry checks if new clients have been clients previously, and if they were affected by those problems, McLay said. If so, they will be repaid.
There is also an online tool for people to check this themselves.
Changes were made to the rules so people affected by the accommodation supplement error would not have those back-payments included in any asset or income testing for 12 months.
That exemption did not apply to people affected by the warrant to arrest issue.
It said the majority of those clients did not have cash assets and were unlikely to be adversely affected within the next 12 months.
The ministry said it was continuing to make improvements to fix any further anomalies and put in place processes so problems were picked up early.