Changed hard-coded value in read_data to NUM_PACKETS

Now the packet type will be properly checked (so long as NUM_PACKETS is kept updated).