player teleport unexpectedly when they hit the terrain

I have a problem with one of these three scripts that is make the position of the player teleport unexpectedly when they hit the terrain to the 0 0 0 position but im not sure of the position , I think it is in the eagleFlying Script but I don’t know why if you can please take a look. Also I hit the flatten button by accident and had to build the terrain up again could this have effected it ?

eagleFlying- modified

 // Use this for initialization
 void Start () {
     Debug.Log("eagleFlying added to: " + gameObject.name);
 }
 
 // Update is called once per frame
 void Update () {
     
     // chase camera 
     
     Vector3 moveCamTo = transform.position - transform.forward * 5.0f + Vector3.up * 2.0f;
     float bais = 0.96f;
     Camera.main.transform.position = Camera.main.transform.position * bais + 
         moveCamTo * (1.0f-bais);
     Camera.main.transform.LookAt (transform.position + transform.forward * 60.0f );
     
     transform.position += transform.forward * Time.deltaTime * speed;// make this a public float 
     
     speed -= transform.forward.y * Time.deltaTime * 50.0f;
     
     if (speed < 5.0f) {
         speed = 5.0f;
     }
     
     else if (speed > 100.0f) {
         speed = 100.0f;
     }
     
     
     transform.Rotate (Input.GetAxis ("Vertical"), 0.0f, -Input.GetAxis("Horizontal") );
     
     float terrainHeightWhereWeAre = Terrain.activeTerrain.SampleHeight( transform.position );
     
     if (terrainHeightWhereWeAre > transform.position.y) {
         
         // input the landing here 
         transform.position = new Vector3 (transform.position.x,
                                           terrainHeightWhereWeAre,
                                           transform.position.z);
     }
     
 }
}

LandFly - modifited

//Need a new script called LandFly and to check the key are call Fly [F] and Land [L]

using UnityEngine; using System.Collections;

public class LandFly : MonoBehaviour {

 public eagleFlying eagleFlying;
 public CharacterMotor characterMotor;
 
 // Use this for initialization
 
 void Start()
 {
     eagleFlying = GetComponent<eagleFlying>();
     characterMotor = GetComponent<CharacterMotor>();
 }    
 
 void Update()
 {
     if(Input.GetButtonDown("Fly"))
     { 
         eagleFlying.enabled = true;
         characterMotor.enabled = false;    
     }
     else
     {
         if(Input.GetButtonDown("Land"))
         { 
             eagleFlying.enabled = false;
             characterMotor.enabled = true;    
         }
     }        
 }
}

I disabled the moving platform in the charactorMotor and it works now ??? thanks taxvi for your help