Fixes bugs with data length and byte order.