fix parsing bug when QoS is set to 0 in PUBLISH frame, and trivial
fix several bugs