Fix reading too many bytes when reading the number of entities in a packet.
Add more verbose logging.