fixed bugs with toggle