Add try/catch for contextmenu