added debugging code (counts datapackets and checks packet drop)