Fix n_packets calculation.