fixed toggle logic