Fix for toggle cleanup function