The header string ("MDTC") actually appears in bytes 513–516, followed by the total packet count in bytes 517–520. The documentation of the function and the comment inside the function states wrongly that header appears in bytes 517-520 and total packet count in 513-516.
Importantly, this was only the documentation, the script was correct, so this does not affect functionality.