Fixing the protocol (zigzag conversion, writing bool in fields, writing/reading double)