Fix for toggle functionality