That call to refreshPackets was breaking the selectedPacket.