ai fixing null pointer