fix segmentation fault

Failure to clear _packet causes the code to segfault.