Understanding AI hallucinations and jailbreaking