fix protocol detection