Fixed more ai code