Fix initialization and end-of-dgram format