A Michigan man has been tricking the system since 2017 by using his dead brother’s name after he was arrested for home invasion. The court system recently figured the mix-up on June 4 but only after officials realized their mistake, Detroit Free Press reports.

Kevin Lee Gray, 37, had been using his brother’s name, Sammie Lee Gray and age (who would’ve been 35 August 20, but died in 2006 at age 22) through the Wayne County court system since his arrest, but is still listed in the system with his picture. 

READ MORE: California governor signs ‘Stephon Clark’s Law’ changing use of deadly force by police rules for police

The error was discovered because Gray was set to be released on parole from serving sentence of 18 months to 15 years at Parnall Correctional Facility near Jackson, Mich., after pleading guilty to home invasion. He was previously locked up for felony firearms offenses in 2007 and crimes related to drugs and stolen property in 2004.

The Free Press reported that that the county’s prosecutors office knew about Gray’s identity and his aliases, but could not give an explanation why court documents on Friday identified and registered him as his brother, according to Wayne County Prosecutor’s Office spokeswoman Maria Miller.

“This parolee was not willing/able to correctly ID himself as he came through the gate,” an alert prison official wrote in a memo.

“He seemed not to know his date of birth, his soc # or any of the other identifiers commonly used,” and we “are not comfortable with allowing him to leave,” the officer wrote. “He appears to resemble the picture on his current face sheet but everything else does not make sense.”

READ MORE: Woman says Brooklyn cops knocked her down while trying to record a relative’s arrest

Miller suspects that the mix-up was a clerical error, while Michigan corrections department spokesman, Chris Gautz, believes it may have a way for Gray to receive leniency since his brother didn’t have much of a criminal record.

Miller said in fact, Gray did not get off easier as a result of using his dead brother’s name. There’s also still no explanation why Gray’s true identity was not noticed through his fingerprints. His criminal history is still listed correctly in the system, since it is based off of his prints.

“It appears the court did not verify his legal name and just went based on what he said his name was at the time of arrest,” and “only the court can change the name,” Gautz said.

After this realization, Miller said the county is unable to charge Gray because they knew his real identity when he was convicted.

This actually works in Gray’s favor because he is set to be paroled this week, according to Gautz.