fixing segmentation fault upon packet received