Fix switch detection