Index: code/branches/presentation2011/src/orxonox/controllers/AIController.cc
===================================================================
--- code/branches/presentation2011/src/orxonox/controllers/AIController.cc	(revision 9000)
+++ code/branches/presentation2011/src/orxonox/controllers/AIController.cc	(revision 9005)
@@ -59,7 +59,13 @@
         if (this->state_ == FREE)
         {
-
+            
             if (this->formationFlight_)
             {
+
+                //changed order -> searchNewMaster MUSTN'T be called in SLAVE-state (bugfix for internal-error messages at quit)
+                random = rnd(maxrand);
+                if (random < 90 && (((!this->target_) || (random < 50 && this->target_)) && !this->forcedFree()))
+                       this->searchNewMaster();
+
                 // return to Master after being forced free
                 if (this->freedomCount_ == 1)
@@ -68,8 +74,4 @@
                     this->freedomCount_ = 0;
                 }
-
-                random = rnd(maxrand);
-                if (random < 90 && (((!this->target_) || (random < 50 && this->target_)) && !this->forcedFree()))
-                    this->searchNewMaster();
             }
 
@@ -78,24 +80,24 @@
         }
 
-        if (this->state_ == SLAVE && this->formationMode_ == ATTACK) //TODO: add botlevel parameter
+        if (this->state_ == SLAVE && this->formationMode_ == ATTACK) 
         {
             // search enemy
             random = rnd(maxrand);
-            if (random < 75 && (!this->target_))
+            if (random < (botlevel_*100) && (!this->target_))
                 this->searchNewTarget();
 
             // next enemy
             random = rnd(maxrand);
-            if (random < 10 && (this->target_))
+            if (random < (botlevel_*30) && (this->target_))
                 this->searchNewTarget();
 
             // shoot
             random = rnd(maxrand);
-            if (!(this->passive_) && random < 75 && (this->target_ && !this->bShooting_))
+            if (!(this->passive_) && random < (botlevel_*100) && (this->target_ && !this->bShooting_))
                 this->bShooting_ = true;
 
             // stop shooting
             random = rnd(maxrand);
-            if (random < 25 && (this->bShooting_))
+            if (random < (1-botlevel_)*50 && (this->bShooting_))
                 this->bShooting_ = false;
 
Index: code/branches/presentation2011/src/orxonox/controllers/FormationController.cc
===================================================================
--- code/branches/presentation2011/src/orxonox/controllers/FormationController.cc	(revision 9000)
+++ code/branches/presentation2011/src/orxonox/controllers/FormationController.cc	(revision 9005)
@@ -383,5 +383,6 @@
     void FormationController::searchNewMaster()
     {
-
+        if (this->state_==SLAVE) 
+           return;
         if (!this->getControllableEntity())
             return;
@@ -588,10 +589,9 @@
     void FormationController::takeLeadOfFormation()
     {
-        if (!this->getControllableEntity())
+        if (!this->getControllableEntity() || this->state_==MASTER)
             return;
 
-	if (this->state_==MASTER) return;
         //search new Master, then take lead
-        if (this->state_==FREE)
+        if (this->state_==FREE && this->myMaster_==0)
         {
           searchNewMaster();
Index: code/branches/presentation2011/src/orxonox/controllers/HumanController.cc
===================================================================
--- code/branches/presentation2011/src/orxonox/controllers/HumanController.cc	(revision 9000)
+++ code/branches/presentation2011/src/orxonox/controllers/HumanController.cc	(revision 9005)
@@ -78,9 +78,7 @@
         this->boosting_ = false;
         this->boosting_ = false;
-        this->tempMaster=NULL;
         HumanController::localController_s = this;
         this->boostingTimeout_.setTimer(HumanController::BOOSTING_TIME, false, createExecutor(createFunctor(&HumanController::terminateBoosting, this)));
         this->boostingTimeout_.stopTimer();
-        this->state_=FREE;
     }
 
Index: code/branches/presentation2011/src/orxonox/controllers/HumanController.h
===================================================================
--- code/branches/presentation2011/src/orxonox/controllers/HumanController.h	(revision 9000)
+++ code/branches/presentation2011/src/orxonox/controllers/HumanController.h	(revision 9005)
@@ -113,5 +113,4 @@
             Timer boostingTimeout_; // A timer to check whether the player is no longer boosting.
             static const float BOOSTING_TIME; // The time after it is checked, whether the player is no longer boosting.
-            FormationController* tempMaster;
 
     }; // tolua_export
Index: code/branches/presentation2011/src/orxonox/controllers/NewHumanController.cc
===================================================================
--- code/branches/presentation2011/src/orxonox/controllers/NewHumanController.cc	(revision 9000)
+++ code/branches/presentation2011/src/orxonox/controllers/NewHumanController.cc	(revision 9005)
@@ -277,5 +277,5 @@
     }
 
-    void NewHumanController::doFire(unsigned int firemode)//TODO??
+    void NewHumanController::doFire(unsigned int firemode)
     {
         if (!this->controllableEntity_)
@@ -291,6 +291,5 @@
         }
         else
-            HumanController::localController_s->getControllableEntity()->fire(firemode);
-
+            HumanController::doFire(firemode); //call for formationflight
     }
 
