Flag toggle works correctly