make toggle work properly