Packet Integrity: nodejs doesn't have 'a'.endsWith()

Doh!

also, track bad packet count.