Fix crash in non-binary protocol handling