Change calculation of packet size