Fixing bug with protocol detection