fixed some AI bugs