If statement not working through update

Hi, I made a script so when the canvas and the text are not enabled, the cursor is locked and the script is enabled. However, it just doesn’t work. The cursor is still locked even when the canvas and text is disabled.

public class pauseMenu : MonoBehaviour
{
    [SerializeField] Canvas canvas;
    [SerializeField] TextMeshProUGUI bean;
    [SerializeField] Camera cam;
    [SerializeField] GameObject areSure;

    private void Start()
    {
        canvas.enabled = false;
        areSure.SetActive(false);
    }
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            canvas.enabled = true;
            Cursor.lockState = CursorLockMode.None;
            GameObject.Find("WeaponHolder").GetComponent<WeaponController>().enabled = false;
        }
        if (bean.enabled == false && canvas.enabled == false)
        {
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible = true;
            GameObject.Find("WeaponHolder").GetComponent<WeaponController>().enabled = true;
        }
    }

Fixed: For anyone wondering I had a click event on the button and just dragged the canvas in there and set it unactive. What I did was I just made a script and put in a method that I instead used to disable the canvas.