That's a loophole in mental health laws, and criminal law in general. A NICS check can't pick up what isn't allowed to be mentioned on an adult's record. If mental health laws allowed(juvenile history) it to be mentioned on an adult's record, current firearms law would've disallowed him from owning them.