fixed some ai bugs