fix toggling bug