Fix bug with gadget state resetting after move between panes