fix problems with jai and small bufgix for NullPointerException