fix bug where event wasn't passed to toggle function