fixed bad toggling and saving of visibility state