fix a bug in packet parsing