Fixed bug in dynamic toggle