camera locks vertical occationally

so i’ve got a script for locking my camera while the menu is open… problem is that it “Occationally” and yes… it really is only occationally which is why i’m completely lost here, locks the vertical look but not the horizontal look when i exit the menu again. The thing that throws me off is that sometimes it works just as it should but every other time it just keeps the vertical look locked down.

any thoughts?

#pragma strict

public var menu1 : UnityEngine.Canvas; 
public var cam1 : Camera;				

function Start () {

}

function Update () {


if (menu1.enabled == true )
{

cam1.GetComponent(MouseLook).enabled = !cam1.GetComponent(MouseLook).enabled;
}


}

abandoned the idea of locking it while the canvas was enabled, apparantly for some reason that was what was making the issue happen, instead i went for locking it on keypress.

#pragma strict

//Apply this script to both Charactercontroller and Main Camera!
function Update () {


    if (Input.GetKeyUp(KeyCode.K)) {
        var mouseLook = GetComponent.<MouseLook>();
        mouseLook.enabled = !mouseLook.enabled;			// Enables and Disables mouselook when K is pressed
}


}