fix toggle logic