Avoid dangling reference to _packet.

Reported by Johan Bergs.