Fix bugs on sendPacket