Workaround due to toggle function not being called in scope