fix protocol parsing