works, but segmentation faults after a few packets