fix function calculate_size and typo with udp packets