Debugged some AI problems