fix switch case in protected scope