Fix crashing bug in ToggleButton