onCollisionEnter not working for ContinuousDynamic collision detection mode

Hi Guys,
I am working on a game that needs to change the collision detection mode from Discrete to Continuous Dynamic and then once it collided, back to Discrete.

Well, it changes from Discrete to ContinuousDynamic but does not change frmo ContinuousDynamic to Discrete.

I am putting the code here
using UnityEngine;
using System.Collections;

public class freezePositionScript : MonoBehaviour {
bool collidedWithFloor = false;
bool changeMode = false;
// Use this for initialization
void Start () {

}

// Update is called once per frame
void FixedUpdate () {
	if(laserCollision.placeObject && laserCollision._collidingObject.gameObject.name == this.gameObject.name)
	{
		print ("Placing object in FreezePosition");
		this.rigidbody.collisionDetectionMode = CollisionDetectionMode.Continuous;	
	}
	
	print ("collided with floor "+collidedWithFloor);
	if(collidedWithFloor)
	{
		//this.rigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete;
		
		//this.rigidbody.constraints = RigidbodyConstraints.FreezePosition;
		
		//this.rigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete;
		print ("Collision mode is "+this.rigidbody.collisionDetectionMode);
		print ("Freezing position for "+this.gameObject.name);
		changeMode = true;
		collidedWithFloor = false;
	}
	if(changeMode)
	{
		this.rigidbody.collisionDetectionMode = CollisionDetectionMode.Discrete;
		
		changeMode = false;
	}
	
	
}

void OnCollisionEnter(Collision col)
{
	
	collidedWithFloor = true;
	print ("Collides in freeze position script");
	
	
}
void onCollisionStay(Collision col)
{
	print ("Collsion for freezing the object");
	
	if(laserCollision.placeObject && laserCollision._collidingObject.gameObject.name == this.gameObject.name && collidedWithFloor)
	{
		
	}
	

}

}

this script is applied to an object like Banana. After the collision detection mode is changed to Continuous Dynamic, the banana keeps on Jumping.

I have found an awesome script

http://wiki.unity3d.com/index.php?title=DontGoThroughThings

this things works well. Simple to implement. Make sure you assign the appropriate layer mask in the inspector when you use this script.