CroiPacket serialize function improved